Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

Define span of management or define span of control ?

Answered: 1 week ago

Question

What is meant by formal organisation ?

Answered: 1 week ago

Question

What is meant by staff authority ?

Answered: 1 week ago

Question

Discuss the various types of policies ?

Answered: 1 week ago