Create a program that displays the fare based on the entered destination. The starting station is Araneta-Cubao Use the code destination to shorten the user's input
'''
Create a program that displays the fare based on the entered destination.
The starting station is Araneta-Cubao Use the code destination to shorten
the user's input.
'''
Destinations = [1,2,3,4,5,6,7,8,9,10]
Dist = [10,20,30,40,50,60,70,80,90,100]
UnitFare = 5
d=0
while(d<1 or d>max(Destinations)):
s = "Enter destination code from 1 to "+str(max(Destinations))+"): "
d = int(input(s))
for r in range(0,len(Destinations)):
if(d==Destinations[r]): k = r
Fare = UnitFare*Dist[k]
print("Unit Fare = ",UnitFare," per Km.")
print("Distance of destination-",d,"from Araneta-Cubao:",Dist[k],"Kms.")
print("Total Fare = ",Fare)
Comments
Leave a comment