I am attempting to make my first bit of code which would be a random number generator and then subtract those numbers. I have this so far:
def rand2():
rand2 = random.choice('123456789')
return int(rand2)
def rand3():
rand3 = random.choice('987654321')
return int(rand3)
I then have a function putting these together:
def rand():
print rand3()
print '-'
print rand2()
ans()
I am attempting to make a solver by adding an ans() function. it would look like this:
def ans():
ans = int(raw_input("Answer: "))
if ans == rand3() - rand2():
print("Correct")
However this does not evaluate the data of return Correct when it is right. Any tips or suggestions on getting raw_input to evaluate the inputed data?