A .Using Python programming language, create a program that allows the user to compute for his/her fare using the information below;
0-5km = P20.00
6-10km = P30.00
11-15km = P40.00
The bus only travels within the province, so the distance does not exceed from 15 kilometers. Your program should ask the user for distance travelled, and your program will compute and display the fare.
Use the If, elif, else statement on your program. Select appropriate data type and create appropriate variable names for your program.
dist = float(input('Enter a tavel distance (km): '))
if dist <= 5:
fare = 2
elif dist <= 10:
fare = 30
else:
fare = 40
print(f'Your fare is P{fare:.2f}')
Comments
Leave a comment