1

I'm quite new to python and I keep getting an error saying that "dest_choice is `not defined"

def flight_choice():
    destination_option = input ("Where do you wnat to go?\n[1] Spain\n [2] Paris")
if destination_option == "1":
dest_choice = "Spain"

then called upon later with

def ticket_amount():
    print("The flight you selected was to" + str(dest_choice) + "Thanks for flying with us"

I'm fairly sure I need to use either "global" or "nonlocal" but I can figure out what with

ReeceSka
  • 11
  • 1
  • 1
    That is a duplicate, but I wouldn't advocate the use of globals. Just return the string to the caller. – cs95 May 07 '18 at 02:56

0 Answers0