Answer to Question #305938 in Python for Kiara

Question #305938

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

1
Expert's answer
2022-03-04T06:31:58-0500
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)
    

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS