TDT4109/Exercise 2/8 - Billettpriser og rabatter/8b.py

21 lines
586 B
Python
Raw Normal View History

2020-09-07 14:44:46 +02:00
def boolInput(question):
while True:
try:
choice = input(question)
assert choice in ['J', 'j', 'N', 'n']
return choice in ['J','j']
except AssertionError:
print('Skriv in J eller N\n')
2020-09-07 14:53:57 +02:00
def miniPriceBranch():
choseMiniPrice = boolInput('Minipris 199,- kan ikke refunderes/endres\nØnskes dette (J/N)? ')
print('Takk for pengene, god reise!' if choseMiniPrice else 'Da tilbyr vi fullpris: 440,-')
2020-09-07 14:44:46 +02:00
daysToTrip = int(input('Dager til du skal reise? '))
if daysToTrip >= 14:
2020-09-07 14:53:57 +02:00
miniPriceBranch()
2020-09-07 14:44:46 +02:00
else:
print('For sent for minipris; fullpris 440,-')