So basically im trying to create a program to
Ask user their first and last name (Should be obligatory with both)
Check if you are from the us or norway
If from any of these countries, are old enough to drink (21 + US and 18+ in Norway)
usa = {"us","the us","usa"}
norway = {"norway","norge","nor"}
legal_usa = 2001
legal_nor = 2004
while True:
print("Hello Welcome to cheapbooze.net!")
first_name,last_name = input("May I ask you your first and last name?: ").split()
nationality = input(f'Nice to have you here {first_name}. From which country are you currently browsing?: ').strip()
if nationality in norway or usa:
age = int(input("Thats a glorious country. May we know which year you were born?: "))
else: print("sorry we only serve customers from the US and Norway atm")
if nationality == usa and age <= legal_usa or nationality == norway and age <= legal_nor:
print("Happy shopping!")
else:
print ("Sorry you seem to be too young to buy alcohol")
The errors I seemt to get:
Typing in two names for "name" works, although with only 1 an error occur: "Not enough values to unpack (expected 2, got 1)". Tried to make a code for if not 2 values inserted give new prompt but dont seem to work, still only get the error message.
It ignores input of country. Else (or if) clause seems to be malfunctional:
It ignores input of age and precedes to give else clause no matter the age input.
Im pretty sure there seems to be some bad syntax in the IF conditions, and obviously in the first function (first_name, second_name). (might be a lot more tbh) .
As im completely new in programming and python hope someone can point me in the right direction.