Task:
Suppose you go to a place for a trip,you need book a plane ticket now,Air ticket prices are affected by the high season and low season,and the prices for first class and economy class are also different;
Assuming the ticket costs 5000 yuan,April to October is the peak season.10% off first class and 40% off economy class,50% off first class and 40% off economy class in low season;
Write a program to output the actual fare based on the month of travel and the selected class.
price=0#First, there is no price because user input is required
print("Please enter the month when you plan to travel:1-12")
month=input()#User enters month
m=int(month)#Store the month entered by the user
print("Do you choose first class or economy class? First class input: 1, Economy class input: 2")
level=input()#User input class
l=int(level)#Store the class entered by the user
if (m>=4 and m<=10):#If you travel between April and October, calculate the fare according to the following discount
if l==1:#10% discount for first class
price = 5000*0.9
else:#Otherwise it's Economy Class, 40% off
price = 5000*0.6
else:#If you are not traveling from April to October, calculate the fare according to the following discount
if l==1:#50% discount for first class
price = 5000 * 0.5
else:#Otherwise it's Economy Class, 40% off
price = 5000 * 0.4
print("Your ticket price is:",price)
There are programs and simulations in the picture, if the comments are not in place, please come up.