You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
837 B
Python
39 lines
837 B
Python
1 year ago
|
from random import randint
|
||
|
num1 = randint(1,10)
|
||
|
num2 = randint(1,10)
|
||
|
|
||
|
#challenge 1
|
||
|
solution = num1 * num2
|
||
|
print("What is " + str(num1) + " times " + str(num2) + "? ", solution)
|
||
|
|
||
|
#challenge 2
|
||
|
solution = num1 + num2
|
||
|
print("What is " + str(num1) + " plus " + str(num2) + "? ", solution)
|
||
|
|
||
|
#challenge 3
|
||
|
question = f"What is {num1} times {num2}? "
|
||
|
answer = int(input(question))
|
||
|
|
||
|
if num1 * num2 == answer:
|
||
|
print("correct")
|
||
|
|
||
|
else:
|
||
|
print("incorrect")
|
||
|
|
||
|
#challenge 4
|
||
|
for number in range(1,12):
|
||
|
if number % 2 <= 0:
|
||
|
print("result")
|
||
|
|
||
|
#challenge 5
|
||
|
question = f"What is {num1} times {num2}? "
|
||
|
answer = int(input(question))
|
||
|
|
||
|
question = f"What is {num1} times {num2}? "
|
||
|
answer = int(input(question))
|
||
|
|
||
|
if num1 * num2 == answer:
|
||
|
print("you got it right")
|
||
|
|
||
|
else:
|
||
|
print("wrong, the correct answer is:", num1 * num2)
|