373,649 views
17 votes
17 votes
Write a program that will input miles traveled and hours spent in travel. The program will determine miles per hour. This calculation must be done in a function other than main; however, main will print the calculation. The function will thus have 3 parameters: miles, hours, and milesPerHour. Which parameter(s) are pass by value and which are passed by reference

User SleeplessKnight
by
2.4k points

1 Answer

12 votes
12 votes
def calculations(miles, hours):
milesPerHour = miles / hours
return milesPerHour

def main():
miles = input("Enter Miles driven: ")
hours = input("Enter Travel Hours: ")
print(calculations(miles, hours))

if __name__=='__main__':
main()
User Nbonniot
by
2.5k points