I am writing a program using functions where it gets the total number of passengers, the total for the fare, and the profit, which is just half of the total fare. The problem I am having is that it runs Please enter the number of passengers for bus1 :
Please enter the number of passengers for bus2 :
Please enter the number of passengers for bus3 :
***********
two times then it gives me the output. I just need it to run once and then give the output. Here's my code:
def CalculateBus1():
bus1 = input("Please enter the number of passengers for bus1 :")
return bus1
def CalculateBus2():
bus2 = input("Please enter the number of passengers for bus2 :")
return bus2
def CalculateBus3():
bus3 = input("Please enter the number of passengers for bus3 :")
return bus3
bus1 = CalculateBus1()
bus2 = CalculateBus2()
bus3 = CalculateBus3()
total = (bus1+bus2+bus3)
fare = float(total*2.50)
profit = float(fare/2)
print("***********")
print"There are total {} passengers from three buses." .format(total)
print"The total fare earned is: ${}" .format(fare)
print"The net profit is: ${}" .format(profit)
print("***********")