121k views
4 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

1 Answer

5 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 Sreetam Das
by
4.9k points