I am having trouble getting a variable from one defined function to another. For example, I want user to select a country from a menu and then that country to be saved in a variable for the first function. After that, user has to select a package they want from the second menu and then tell the program how many people ages 12+, 2+ and 2- are going.
Once it is done, I want all the saved information to go to a table, for example if a user had selected Spain and full board package and there are 2 people aged 12+ and 1 people aged 2+i want the program to go to Spain table and add the prices. the prices are different for all ages.
below is the code I got so far, I was wondering if anyone could help with it.
def result():
global spian
global spianf
total=spian*n+spianf
print total
def total():
global n
global i
result()
def age ():
n=input("please select number of people age 12+")
m=input("please select number of people age 2+ ")
b=input("please select number of people age 2-")
total()
result()
def pack():
print "1.Full Boaard"
print "2.Half board"
print "3.Beds only"
print "4.Main menu"
n=raw_input("please select you package ")
if n=="1":
age()
return n;
if n=="2":
age()
if n=="3":
age()
if n=="4":
country()
def country ():
print "1.Spain"
print "2.Portugal"
print "3.Italy"
print "4.Turkey"
print "5.Exit"
i=raw_input("Please enter your choice of country ")
if i=="1":
pack()
spain=1
if i=="2":
pack()
if i=="3":
pack()
if i=="4":
pack()
if i=="5":
exit
country()
spian=150
spianf=50