My code does not run and i can't seem to get the score to print

25 Views Asked by At
def tf_quiz():

    user_name
    user_year

print("Welcome to my true or false divison quiz") #welcome message

user_name=str(input("please enter in your name")) #asks/stores user input

user_year=str(input("please enter in your year")) #asks/stores user input

print("all you have to do is type T/F for each question") #explaning the task

print ("12/3 = 4") #asks the question
if correct_ans == "T" : #correct answer
            print ("Correct!") #prints correct if the answer is correct
            score = score +1
if correct_ans == "F" : #incorrect answer
            print ("incorrect!")  #prints incorrect if the answer is incorrect

print ("42/6 = 7")
if correct_ans == "T" :
            print ("Correct!")
            score = score +1
if correct_ans == "F" :
            print ("incorrect!")  
    
print ("18/3 = 4")
if correct_ans == "F" :
            print ("Correct!")
            score = score +1
if correct_ans == "T" :
            print ("incorrect!")  

print ("40/5 = 9")
if correct_ans == "F" :
            print ("Correct!")
            score = score +1
if correct_ans == "T" :
            print ("incorrect!") 

print ("90/10 = 9")
if correct_ans == "T" :
            print ("Correct!")
            score = score +1
if correct_ans == "F" :
            print ("incorrect!") 

print (" 16/2= 4")
if correct_ans == "F" :
            print ("Correct!")
            score = score +1
if correct_ans == "T" :
            print ("incorrect!")

print ("9/3 = 3")
if correct_ans == "T" :
            print ("Correct!")
            score = score +1
if correct_ans == "F" :
            print ("incorrect!")

print ("45/9 =5 ")
if correct_ans == "F" :
            print ("Correct!")
            score = score +1
if correct_ans == "T" :
            print ("incorrect!")

print ("81/9 = 7")
if correct_ans == "F" :
            print ("Correct!")
            score = score +1
if correct_ans == "T" :
            print ("incorrect!")

print("49/7 = 7")
if correct_ans == "T" :
            print ("Correct!")
            score = score +1
if correct_ans == "F" :`enter code here`
            print ("incorrect!")

#Main program
tf_quiz()

I can't print the name and score for the user using this code, and it also does not run. I have tried multiple different things but i still cannot get it to work no matter what i do to try and fix it. the code also will not run and it will not give me any problems or ways to make it run.

0

There are 0 best solutions below