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

21 lines
586 B
Python

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')
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,-')
daysToTrip = int(input('Dager til du skal reise? '))
if daysToTrip >= 14:
miniPriceBranch()
else:
print('For sent for minipris; fullpris 440,-')