You can make count
global:
count = 0
def intro(start):
if start == "yes" or start == "y":
print("Lets begin.")
else:
print("Thanks for checking it out! Bye Bye!")
def question1():
global count
count += 1
return count
def question2():
global count
count += 1
return count
def main():
print("Hello There! Welcome to an all new Trivial Pursuit!")
print("You have twenty multiple choice questions and twenty true and false.")
print ("Each question is one point. Your score will be presented at the end. ")
print("Would you like to begin? Press y or yes")
start = input()
intro(start)
question1()
question2()
print("You got", count, "right!")
main()
I edited your code to have the functions just add to count
. I know globals aren’t recommended, but this may work for you.
7
solved I would like to total the amount of correct answers and display it at the end getting error local variable referenced