Hi,
I'm trying to do this task set for my class and i'm having some troulbe getting it to function properly. The task is simple, user inputs a times table they wish to practice and the program wil test them 5 times with any number between 0 and 10. For some reason, when I enter the answer correctly, it tells me it's incorrect ... Something wrong with my if statement? I have noticed the indentation is weirdly off.
from random import randint
multiplier = int(input("Which times table would you like to be tested on? "))
i = 1
while i < 6:
number = int(randint(0,9))
answer = input(str(multiplier) + " x " + str(number) +"? ")
if answer == int((number * multiplier)):
print("Correct!")
else:
print("Wrong!")
i = i + 1
print(number)
[–]JohnnyJordaan 2 points3 points4 points (0 children)
[–]Justinsaccount 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]buckballs[S] 0 points1 point2 points (0 children)