Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #recommend train
- import datetime
- import sys
- now = datetime.datetime.now()
- hour = now.hour
- time = now.strftime("%H:%M")
- date = now.strftime("%d/%m/%Y")
- from datetime import datetime, timedelta
- now = datetime.today()
- he = now + timedelta(minutes=15)
- time15 = he.strftime("%H:%M")
- list = ["S Train = 4500 gils each | 30 minutes" , "A Train = 3500 gils each | 40 minutes" , "B Train = 2500 gils each | 60 minutes" , "C Train = 1500 gils each | 75 minutes"]
- S = 4500
- A = 3500
- B = 2500
- C = 1500
- #1000-2000 , 2000-3000 , 3000-4000 , 5000-6000
- print()
- print("Train to Gridania")
- print(20*'-')
- user = input("Please type your name = ")
- if hour < 12:
- greeting = f"Good morning {user}!"
- elif hour < 18:
- greeting = f"Good afternoon {user}!"
- else:
- greeting = f"Good evening {user}!"
- print()
- print(greeting)
- print(f"Today is {date}. The time is {time}.")
- ready = input("Order ticket? (yes/no): ")
- while ready == "yes" :
- try:
- print()
- peeps = int(input("How many people? "))
- budget = int(input("Please enter a budget for each person (1000-5000 gils) : "))
- if budget < 1000 or budget > 5000:
- raise ValueError
- elif budget >= 1000 and budget <= 2000 :
- print("~~ C Train. Duration 75 minutes. ~~")
- elif budget >= 2000 and budget <= 3000 :
- print("~~ B Train. Duration 60 minutes. ~~")
- elif budget >= 3000 and budget <= 4000 :
- print("~~ A Train. Duration 40 minutes. ~~")
- else:
- print("~~ S Train. Duration 30 minutes. ~~")
- again = input("Confirm choice? (yes/no) ")
- if again == 'yes' :
- print(20*'-')
- for i in list:
- print(i)
- print(20*'-')
- if budget >= 1000 and budget <= 2000 :
- order = peeps * C
- print(f"Passenger {user} boarding C Train for {peeps} people.")
- print(f"Total payment: {order} gils")
- print("Train leaving in 15 minutes from now.")
- elif budget >= 2000 and budget <= 3000 :
- order = peeps * B
- print(f"Passenger {user} boarding B Train for {peeps} people.")
- print(f"Total payment: {order} gils")
- print("Train leaving in 15 minutes from now.")
- elif budget >= 3000 and budget <= 4000 :
- order = peeps * A
- print(f"Passenger {user} boarding A Train for {peeps} people.")
- print(f"Total payment: {order} gils")
- print("Train leaving in 15 minutes from now.")
- elif budget >= 4000 and budget <= 5000 :
- order = peeps * S
- print(f"Passenger {user} boarding S Train for {peeps} people.")
- print(f"Total payment: {order} gils")
- print("Train leaving in 15 minute from now.")
- reenter = input("Confirm your train name: (C/B/A/S) ")
- confirm = input("Confirm order? " )
- while confirm == 'yes':
- pay = order
- print()
- pay = int(input("Please input an amount of money: "))
- if pay < order :
- print("Oops. Not enough. Please reenter amount.")
- print()
- continue
- elif pay == order:
- print(f"Exact amount of {order} gils received. Thanks !")
- change = 0
- print()
- print("HERE'S YOUR TICKET")
- print("-----------------------------------------")
- print("| Train to Gridania Ticket")
- print(f"| Passenger: {user}")
- print(f"| Boarding {reenter} Train for {peeps} people")
- print(f"| -> Train will be leaving at: {time15}")
- print(f"| Total payment: {order}")
- print(f"| Change: {change}")
- print(f"| Printed: {date}")
- print("-----------------------------------------")
- print("THANK YOU!")
- sys.exit()
- else:
- change = pay - order
- print(f"{pay} gils received. Here's your change!")
- print(f"Output: ${change}. Thanks!")
- print()
- print("HERE'S YOUR TICKET")
- print("-----------------------------------------")
- print("| Train to Gridania Ticket")
- print(f"| Passenger: {user}")
- print(f"| Boarding {reenter} Train for {peeps} people")
- print(f"| -> Train will be leaving at: {time15}")
- print(f"| Total payment: {order}")
- print(f"| Change: {change}")
- print(f"| Printed: {date}")
- print("-----------------------------------------")
- print("THANK YOU!")
- sys.exit()
- else:
- print()
- continue
- except ValueError:
- print("! Not a valid input !")
- print("Please enter as stated.")
- print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement