Question: I am working on a lab for my python class and I am asked to follow instructions, this are the instructions (below) I did everything

I am working on a lab for my python class and I am asked to follow instructions, this are the instructions (below) I did everything except for this step

Call one of these two functions to calculate tuition, depending on user input.

can anyone help me figure out how I can call one of these two functions depending on the user input. (I've provided my code)

Write a program to calculate tuition for students of a community college. In-state students pay $60 per credit hour, and will pay for only 12 credit hours even if they register for more hours. Out-of-state students pay $200 per credit hour, and will pay for 15 credit hours as the maximum. In the main function, ask the user whether he is in-state or out-of-state. Then ask the user how many credit hours he is taking. Pass number of credit hours to the following two functions:

tuition_instate: Calculate and display tuition for in-state students.

tuition_outstate: Calculate and display tuition for out-of-state students.

Call one of these two functions to calculate tuition, depending on user input.

The following are two examples

Are you in-state students? [y/n] y

How many credit hours are you taking? 14

You are paying in-state rate

Please pay $ 720

Are you in-state students? [y/n] n

How many credit hours are you taking? 17

You are paying out-of-state rate

Please pay $ 3000

MY ACTUAL CODE:

def main(): residency = input("are you in-state student[y/n]") creditHours = int(input("How many credit hours are you taking: ")) tuition_instate(creditHours) tuition_outstate(creditHours) def tuition_instate(creditHours): if creditHours <= 12: total = creditHours * 60 print("You are paying in-state rate") print("please pay", total) else: print("you are pagin out-state rate") print("please pay", 60 * 12) def tuition_outstate(creditHours): if creditHours <= 15: total = creditHours * 200 print("you are paying out-state rate") print("Please pay", total) else: print("you are paying out-state rate") print("please pay", 15 * 200 ) #HOW DO I CALL ONE THE TWO FUNCTIONS DEPENDING ON THE USER INPUT(RESIDENCY)? 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!