I am not good at coding and I am trying to change that but I am having troubles with this assignment. I have to create a math quiz where I ask the user to answer a simple addition question that uses two random integers. If they get the question right I am supposed to say congrats and ask them if they would like to answer another. If they get it wrong then the program needs to print the correct answer and again ask them if they would like to answer another until the user says no. Any suggestions would help immensely, thanks.

import random

from sys import exit

answer=str(a+b)

def loop(q):

q=input('Would you like to answer another question?')

if q == ("yes"):

return (question)

else:

print ("Goodbye")

exit

def rand(a,b):

a=random.randint(1,1000)

b=random.randint(1,1000)

def question(q,a,b,math):

math=raw_input("What is" (a + b)

if math == (answer):

return("congratulations")

else:

print("Sorry the correct answer is" (answer))