Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function named courseLoad. The function courseLoad takes two parameters

ID: 3870335 • Letter: W

Question

Write a function named courseLoad. The function courseLoad takes two parameters
1. light, an int that is the threshold for a light course load

2. heavy, an int that is the threshold for a heavy course load

The function courseLoad should

1. ask the user how many credits they are taking

2. if the number of credits is less than or equal to light, print a message saying that that number of credits is a light schedule and return the string 'light'

3. if the number of credits is greater than or equal to heavy, print a message saying that that number of credits is a heavy schedule and return the string 'heavy'

4. otherwise print a message saying that that number of credits is an average schedule and return the string 'average'

For example, the following would be correct input and output

>>> mySchedule = courseLoad(11, 16)

How many credits are you taking? 14

14 is an average schedule

>>> print(mySchedule)

average

SOLVE USING PYTHON VERSION 3.6

Explanation / Answer

def courseload(c,d): #define function to find if heavy, light or average course
    inp=input("No of hours :") #prompt user for weekly course hours
    if inp > d:    #check if no of hours>max treshold
        return "heavy"
    elif inp < c:   #check if no of hours<min treshold
        return "light"
    else:
        return "average"
    return;
x=input("First treshold :")   #prompt for lowest treshold
y=input("Second treshold :") #prompt for max treshold
mySchedule=courseload(x,y)    #find if heavy, light or average
print("It is a "+mySchedule+" schedule") #print whether it is a heavy, light or average schedule

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote