My Classroom Python Experience at CEU: Exploring the Plumbing Business

Ranjan Sapkota
CEU Threads
Published in
10 min readMar 1, 2024

As an Economics student, I recognised the value of proficient coding skills for data analysis. My experience was primarily with STATA for economic analysis, but based on several recommendations from my seniors and peers, I decided to explore Python and R, as the two languages were praised for their superior coding structure compared to STATA.

To deepen my understanding and respond to the growing demand for Python in the academic circle as well as the job market, I enrolled in the “Introduction to Python” course at the Central European University, taught by Professor Arieda Muço.

By Talia Dunyak

In the latter part of the course, the Professor introduced us to an interesting and unique problem set during an in-class quiz. The task challenged us to rethink our coding approach and logic in response to a hypothetical scenario where plumbers adapt to future changes by integrating AI and robotics into their business practices, reflecting broader technological advancements.

Importantly, in this article, I will take you through my experience of solving the problem set which, I believe, was the heart of the course. In fact, this medium article is also a part of our final assignment for the course. While doing so, I shall first share the question along with my code answering that question and an explanation of the code and general logic in order. For Part 1 of the task, we were asked to:

*****

You are a plumber who is starting a business with other friends, called Modern Plumbers. Some plumbers are more junior and some are more experienced. You have to decide how to charge your work hours. You use digital tools to keep track of your appointments and calculate billing. Since you just started the company, you can’t hire software developers, but you did take an Introduction to Python, so you decided to code this yourself. Your task is to create a function that helps you and other plumbers calculate the total cost of their job

***

def cost(experience, hours_worked, distance=0):
# Define hourly rates by experience level
rates = {'junior': 20, 'middle': 50, 'senior': 100}
travel_fee_per_mile = 5 # Travel fee per mile

# generating a scenario whereby it checks if the experince level is one among the ones mentioned in "rates" function
if experience not in rates:
return "Experience level not available."

# calcualting the total hourly cost as per the hours worked
hourly_cost = rates[experience] * hours_worked

# travel cost for plumbers while dealing with business procedures
travel_cost = travel_fee_per_mile * distance

# Calculating the total cost of plumbers
total_cost = hourly_cost + travel_cost

return f"Total job cost : ${total_cost:.2f}"

# Checking for the cost of a person with middle level experince
print(cost('middle', 3, distance=30))

I categorised the workers into three levels of experience: junior, middle, and senior, with the idea that each level should have a different hourly pay rate, as indicated in the second line of the code as well. Additionally, when the plumbers get a call from the customers to come and fix things, the travel ‘to and from the customers' place should be accommodated by the company. Hence, to account for this, I added a fixed rate of 5 euros per mile as the travel expenses.

Proceeding on to the question, we had an added layer of task after this, which was quite interesting in terms of generating the output by coding. The question was like this:

****

Now assume that Modern Plumbers decides to modernize and use AI and Robotics as follows:

AI-powered diagnostic tools help plumbers identify the source of a leak or other problem more quickly and accurately.

Robotic snakes or cameras can be inserted into pipes to inspect them and perform repairs without the need for digging or other invasive techniques.

3D printing technology that can be used to create custom-fit replacement parts for plumbing systems.

  1. How would their pricing strategy change in this case?
  2. Should the plumbers be worried about these advances in science?

******

Now, this is a very interesting question given that it reflects a lot about our present-day practical life discussions. The introduction of technological advancements in the past, particularly in robotics, sparked widespread concern about the potential replacement of humans by robots across various jobs. One of the very logic every other person would give would be the idea of how drivers would be losing their jobs in the long run. This fear, in some way, has also echoed today with the rise of AI tools like ChatGPT, which brings into question the impact on skilled labor markets (i.e., especially works that dealt with codings). A specific concern is the efficiency ChatGPT introduces, where tasks that previously required 10 people and 50 minutes to complete, could now potentially be completed by 4 people in 30 minutes. While new technology introduction in the world, undoubtedly creates short-term job losses (as shown by history at times), it is also pertinent to understand that it also enhances efficiency and productivity over time (also shown by history many times. It is also discussed in the later part of this article as well).

def cost_with_tech(experience, hours_worked, distance=0, tech_efficiency=0.10):
# Define hourly rates by experience level
rates = {'junior': 20, 'middle': 50, 'senior': 100}
travel_fee_per_mile = 2 # Travel fee per mile

# Check if the experience level is valid
if experience not in rates:
return "Experience level not available."

# calculating the total hourly cost as per the hours worked
hourly_cost = rates[experience] * hours_worked

# Apply technology efficiency savings
tech_savings = hourly_cost * tech_efficiency
adjusted_cost = hourly_cost - tech_savings

# Extra travel cost incurred
travel_cost = travel_fee_per_mile * distance

# Calculating the total cost with tech efficiency included
total_cost = adjusted_cost + travel_cost

return f"Total job cost with tech: ${total_cost:.2f}, Savings from tech: ${tech_savings:.2f}"

# Checking for the cost of the person with a middle level experience like earlier to see the cost dfifference
print(cost_with_tech('middle', 3, distance=40, tech_efficiency=0.15))

With an idea of including the concept of technological efficiency into the hypothetical plumbers scenario, I introduced AI-powered diagnostic tools, robotic snakes or cameras, and 3D printing technology all as tech_efficiency as highlighted in the first line of code above as well. While navigating to solve this question, what I thought was that, when tech is integrated, mostly, we can expect to see a reduction in the need for hiring a larger workforce and a decrease in the total hours worked. This is assumed as AI can enhance efficiency and enable faster completion of tasks with fewer employees. Despite these technological advancements, I decided to not change the existing pricing strategy for customers, believing that the introduction of technology should not directly affect service charges. While the technology reduces the company’s total costs by decreasing staff requirements and work hours, I chose not to reflect this cost reduction in customer pricing, diverging from the typical approach where companies generally raise prices in response to increased costs.

Over time, tech advancements have consistently redefined the job market. While initial developments often lead to short-term job losses, history shows that humans generally adapt by learning new skills to meet the changing demands of the workplace. In the long run, this facet of adaptability to learning new skills also facilitates in the creation of new job opportunities. Such are a few of the ripple effects of technological progress. For example, when the first computers came into the market, it also displaced a lot of jobs, especially traditional manual jobs like typewriting, among others. However, having said that it also created several new job opportunities for skilled workers like software engineers and IT experts, among others.

By Cartoonstock

In the context of the hypothetical plumbers scenario, while the introduction of AI-powered tools and robotics may reduce the need for traditional plumbing tasks, it also opens up new employment opportunities. For example, Plumbers could enhance their skills to become technicians specialising in the maintenance and operation of these advanced technologies or move into roles that focus on the design and improvement of plumbing solutions using 3D printing technology. Thus, I genuinely believe that tech progress should not be taken as a cause for concern among plumbers but seen as an opportunity for growth, learning new skills, and also as an opportunity to earn more as high-skill jobs are always more likely to be paid more.

Proceeding on to the task further, we were advised to work further on the same solution and see how our solutions evolved ever since the first in-class quiz reflect on this exercise and compare it with previous versions of our in-class quizzes.

Hence, for this very purpose, I decided to change the way the plumbers earn by adding job_type_multipliers based on the difficulty level of the job.

def cost(experience, hours_worked, job_type, distance=0):
# Define hourly rates by experience level
rates = {'junior': 20, 'mid-level': 50, 'senior': 100}
travel_fee_per_mile = 5 # Travel fee per mile

# Job type multipliers
job_type_multipliers = {
'standard': 1.0, # No extra earnings for standard jobs
'complex': 1.25, # 25% increase for complex jobs
'emergency': 1.5 # 50% increase for emergency jobs
}

# Checking if the experience level is valid
if experience not in rates:
return "Experience level not available."

# Checking if the job type is valid
if job_type not in job_type_multipliers:
return "Job type not available."

# Calculating the hourly cost based on experience level and job type
hourly_rate = rates[experience] * job_type_multipliers[job_type]
hourly_cost = hourly_rate * hours_worked

# Calculatinh the total travel cost
travel_cost = travel_fee_per_mile * distance

# Calculating the total cost
total_cost = hourly_cost + travel_cost

return f"Total job cost: ${total_cost:.2f}"

# Checking for the cost of a person with middle level experince that worked 3 hours and traveled 30 km.
print(cost('mid-level', 3, 'complex', distance=30))

The core reason behind adding job_type_multipliersis to address the idea that, harder jobs should be paid more. Sometimes, we require employees who think “on the job”, or on the spot very smartly and get work done. For such cases, I think they should be paid slightly more than the usual standard rate. This also helps them to work harder and smartly so that they can earn extra money. Hence, the harder the task, the slightly better the pay, for the same hours worked.

**

Additionally, explore at least one aspect of coding that we didn’t cover in class

**

Functions without arguments was one of the topics that was not covered in the class. A function without arguments is a function that is defined without any parameters and it does not take any input. In that case, I will showcase one example by adding the service fee to our code used for the Plumbers case:

# Define a function to calculate a fixed service call fee
def service_call_fee():
# Define a fixed fee for a service call
fixed_fee = 50

# Return the fixed fee
return fixed_fee

# Call the function and print the service call fee
print(service_call_fee())

Here, def service_call_fee(): defines a new function called service_call_fee that takes no arguments and return fixed_fee - The function returns the value stored in fixed_fee when it is called.

Likewise, lets integrate this code to our Plumbers code and see how it looks:

# adding funtion that takes no arguments to our earlier code from first quiz 
def service_call_fee():
# defining a fixed fee for a service call
fixed_fee = 70
# Return the fixed fee
return fixed_fee

def cost(experience, hours_worked, distance=0):
# Define hourly rates by experience level
rates = {'junior': 20, 'middle': 50, 'senior': 100}
travel_fee_per_mile = 5 # Travel fee per mile

# generating a scenario whereby it checks if the experince level is one among the ones mentioned in "rates" function
if experience not in rates:
return "Experience level not available."

# calcualting the total hourly cost as per the hours worked
hourly_cost = rates[experience] * hours_worked

# travel cost for plumbers while dealing with business procedures
travel_cost = travel_fee_per_mile * distance

# adding the fixed service call fee to the total cost
total_cost = hourly_cost + travel_cost + service_call_fee()

return f"Total job cost : ${total_cost:.2f}"

# Checking for the cost of a person with middle level experince
print(cost('middle', 3, distance=30))

Here, I just added the function that takes no argument at the top of the code ( service_call_fee) and added the same in the total cost to include the service cost while calculating the total cost of each plumber.

***

Consider how AI could have been used, or the reasons it was not used, in the classroom.

****

Our professor was very supportive of AI use, but she also pressed a lot about using it with utmost caution. We were advised to use AI as a tool without letting it take over our creative idea-generation process in coding, especially for simple tasks. For me, as a beginner, ChatGPT proved invaluable, particularly when I had errors. Some of the errors were very confusing to understand. In such cases, ChatGPT was of immense help. It was also very helpful to increase my understanding of how my code would perform compared to how it would have performed if I had used some other patterns of code.

boredpanda.com

Conclusion

This course was really a rewarding experience as it introduced me to Python and now I am a bit more confident than before. Understanding its importance even more and realising how enjoyable the course was, I was motivated to enroll myself in another Python course called, “Text Analysis and Visualisation”. So far that has also been really nice. I have already started using Python for some of my data analysis work and will surely use Python while pursuing data exploration and analysis when I start working on my thesis in my second year.

I would definitely recommend this course to fellow students at CEU who have no idea how Python works. This course can really be a beginner’s guide to enhancing your coding skills in Python. Go for it.

Cheers!! And Happy Codding!!

--

--