Lesson 6: Multiplications

posted Nov 8, 2017, 7:56 AM by Attila Lengyel   [ updated Nov 9, 2017, 7:51 AM ]
print("This is the multiplication table:")

for x in range(0,11):
  for y in range(0,11):
    product = x * y
    print(x,"x",y,"=",product)

import random

goodanswer = 0
for x in range(0,10):
  a = random.randint(0,10)
  b = random.randint(0,10)
 
  print("What is", a,"x",b,"= ?")
  answer = input()
 
  if a * b == int(answer):
    print("Correct")
    goodanswer += 1
  else:
    print("You missed it")
print("Your result is ",goodanswer,"/10")


Comments