Create a Python program (using any of the selection structures) that will accept distance in kilometer/s as input, and student or elderly passengers will pay the discounted rate, disabled passengers will get an additional 10% discount with the original discounted rate, otherwise the regular fare will be used as basis for the computation of fare. The output will be the total fare for the passenger.
Start price for :
regular passenger - 9.00
Student/ Elderly/ Disabled- 6.20
Sample output:
Enter Distance in Kilometer/s: 12
Regular/ Student/ Elderly/ Disabled: Disabled
Total Fare: 14.175
dist = int(input('Enter distance in kilometres here: '))
stud_eld = input('Enter yes if passenger is a student or an elder: ')
dis = input('Enter yes if passenger is disabled: ')
fare = int(input('Enter fare: '))
if stud_eld == 'yes':
fare = 0.95 * fare
if dis == 'yes':
fare = 0.9 * fare
print(fare)
elif dis == 'yes':
print(0.9 * fare)
else:
print(fare)
Comments
Leave a comment