Question: I am getting a variable not defined error for pie _ 1 , although I have already defined it . The error is on line

I am getting a variable not defined error for pie_1, although I have already defined it. The error is on line 86. Here is my code.
def get_pies():
get_pie_1()
get_pie_2()
get_pie_3()
def get_pie_1():
pie_1= str(input("What is the first pie type that guests can choose from?: "))
return pie_1
def get_pie_2():
pie_2= str(input("What is the second pie type that guests can choose from?: "))
return pie_2
def get_pie_3():
pie_3= str(input("What is the last pie type that guests can choose from?: "))
return pie_3
def check_votes(pie_num_votes):
result = True
if int(pie_num_votes)<= int(guests):
result = True
else:
result = False
return result
def update_pie(pie_num_votes, pie_num):
while check_votes(pie_num_votes)== False:
print("The amount of votes for each pie may not exceed the total number of guests")
pie_num_votes = int(input("How many people vote for "+ pie_num +"?: "))
def get_votes():
print("There can only be one vote per person!")
pie_1_votes = int(input("How many people vote for "+ str(pie_1)+"?: "))
update_pie(pie_1_votes, pie_1)
pie_2_votes = int(input("How many people vote for "+ str(pie_2)+"?: "))
update_pie(pie_2_votes, pie_2)
pie_3_votes = int(input("How many people vote for "+ str(pie_3)+"?: "))
update_pie(pie_3_votes, pie_3)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!