1. Engineering
2. Computer Science
3. struggling with my program where i want to create a...

# Question: struggling with my program where i want to create a...

###### Question details

struggling with my program, where i want to create a game that loops and counters number of loops played, number of correct answers and averge score. this is the code i have so far hopefully you can see what im trying to get at. im keeping it to this specific output display

import randomprint("---------------------------")print("Welcome to a fun math game!")print("---------------------------")def main():    counter = 0    num1= random.randrange(1, 1001, 2)    num2= random.randrange(1, 1001, 2)    if num1 < num2:       print(" ",num2)       print("-",num1)       ans = num2 - num1       print("--------")           else:        print(" ",num1)        print("-",num2)        ans = num1 - num2        print("--------")    g1 = int(input(""))    if g1 == ans:       print("Congratulations")    if g1 != ans:       print("Whoops! that's incorrect,the answer is",ans)    counter += 1    startagain()def startagain():        rego = int(input("Would you like to try again 1/2"))    if rego == 1:        main()         else:        print("You attempted", counter, "questions.")        print("You got",num_correct, "questions correct.")        print("That is a score of %", average)        exit(0)main()
###### Solution by an expert tutor 