Tessa
2012-12-12 07:26:35 UTC
there's more code but it's basically the same just subt, div, and mult...
import random
#list variables
num1 = random.randint(1, 50)
num2 = random.randint(1, 50)
num3 = random.randrange(2, 200, 2)
num4 = random.randrange(2, 20, 2)
add = num1 + num2 + num3
subt = num1 - num2
mult = num1 * num4
div = num3 / num4
print """Welcome To Math Training!
Here, you will practice your basic math skills, addition, subtraction and multiplication, by solving a few equations!
So let's get started!"""
raw_input("\n\nPress the enter key to start the game.")
while True:#repeat the program
#addition
print "Solve:", num1, "+", num2, "+", num3, "="#show the equation
guess = float(raw_input("What's your answer? "))#ask the user for the solution to the problem
if guess == add:
print "Good Job! You got it."#congratulate the user if the answer is right
else:
if guess != add:
print "Wrong answer! Try again."#tell the user the answer is wrong and the game is over
guess = float(raw_input("What's your answer? "))
if guess == add:
print "Good Job! You got it."
else:
print "Wrong answer! You failed."
print "The correct answer was", add#print the right answer
PLEASE THIS IS URGENT! I'LL GIVE 5STARS IF YOU HELP ME :3
thanks