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)? ')
|
|
|
|
if choseMiniPrice:
|
|
|
|
print('Takk for pengene, god reise!')
|
|
|
|
else:
|
|
|
|
normalBranch()
|
|
|
|
|
2020-09-07 14:44:46 +02:00
|
|
|
def evalDiscountPercent():
|
|
|
|
age = int(input('Skriv inn din alder: '))
|
|
|
|
if age < 16:
|
|
|
|
return 50
|
|
|
|
elif age >= 60:
|
|
|
|
return 25
|
|
|
|
|
|
|
|
hasSpecialSocialStatus = boolInput('Er du student eller militær (J/N)?')
|
|
|
|
return 25 if hasSpecialSocialStatus else 0
|
|
|
|
|
2020-09-07 14:53:57 +02:00
|
|
|
def normalBranch():
|
|
|
|
discountPercent = evalDiscountPercent()
|
|
|
|
print(f'Prisen på biletten blir: {440 - 440 * discountPercent/100}')
|
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:
|
2020-09-07 14:53:57 +02:00
|
|
|
normalBranch()
|