This is to be a simple mathematics program for my child to help with arithmetic.
However, the IF statement does not work in Python3 but does in Python2!
Please may I ask what has changed (as I can't seem to find the answer)?
#import from library
import random
import sys
#display the python version
print(sys.version)
#computer selects two random numbers between 1 and 10
x = random.randint(1,10)
y = random.randint(1,10)
#print x and y values
print("For x =", x, "and y =", y)
#calculate the correct answer to the sum of the two numbers and store it in the variable named "correct"
correct = x + y
#ask the user what is the sum of the two random numbers and provide a response
answer = input("What is the sum of x plus y ? ")
if answer == correct:
print("well done")
else:
print("Incorrect. The correct answer is", correct)