fork download
  1. import random
  2. m = 1
  3. while m != 0:
  4. n1 = int(random.random() * 9) + 1
  5. n2 = int(random.random() * 9) + 1
  6. m = int(raw_input("{} * {} = ".format(n1, n2)))
  7. print ("correto!" if m == n1 * n2 else "errado!!")
  8.  
  9. #https://pt.stackoverflow.com/q/259931/101
Success #stdin #stdout 0.01s 9632KB
stdin
5
5
5
0
stdout
9 * 6 = errado!!
2 * 2 = errado!!
6 * 1 = errado!!
4 * 9 = errado!!