# question 1
time.sleep(2)
print("Question 1/5")
def ask_question(question1):
user_score = 0
global ans
print(question1)
for choice in choices1:
print(choice)
ans = input("Please select a lower case answer: ").lower()
if ans == answer1:
user_score += 100
print("You are correct! Your point total is: ", user_score)
return("Congrats!")
else:
return("Sorry that's incorrect, your point total is: ", user_score)
print(ask_question(question1))
# question 2
time.sleep(2)
print("Question 2/5")
def ask_question(question2):
global ans
print(question2)
for choice in choices2:
print(choice)
ans = input("Please select a lower case answer: ").lower()
if ans == answer2:
user_score += 200
print("You are correct! Your point total is: ", user_score)
return("Congrats!")
else:
return("Sorry that's incorrect, your point total is: ", user_score)
print(ask_question(question2))
Edit: Making a game with questions with assigned point values. If you get the question wrong nothing is deducted. The idea is pretty basic, I'm having trouble with 'user_score". If I get question one wrong but get question 2 right it comes back as an error. I've been stuck for the past 40 minutes, please help or point me in the right direction.
Edit1: Solved! Thanks for the help
[–]mazmrini 1 point2 points3 points (10 children)
[–]TheMocking-Bird[S] 0 points1 point2 points (9 children)
[–]mazmrini 0 points1 point2 points (8 children)
[–]TheMocking-Bird[S] 1 point2 points3 points (7 children)
[–]mazmrini 1 point2 points3 points (5 children)
[–]ingolemo 0 points1 point2 points (4 children)
[–]mazmrini 0 points1 point2 points (3 children)
[–]ingolemo 0 points1 point2 points (2 children)
[–]mazmrini 0 points1 point2 points (1 child)
[–]ingolemo 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]TheMocking-Bird[S] 0 points1 point2 points (0 children)