# 99乘法练习
import random
import time
num=0
start=time.time()
for x in range(10):
a=random.randint(1,9)
b=random.randint(1,9)
print('请小余同学回答:',a,'x',b,'等于多少?')
c=input()
if int(c)==(a*b):
print('回答正确,你太棒了!')
num+=1
else:
print('阿欧!')
end=time.time()
print('耗时:',end-start)
print('你一共做对了',num,'做错了',10-num)
# 99除法练习
import random
import time
num=0
start=time.time()
for x in range(10):
a=random.randint(1,9)
b=random.randint(1,9)
print('请小余同学回答:',a*b,'÷',b,'等于多少?')
c=input()
if int(c)==a:
print('回答正确,你太棒了!')
num+=1
else:
print('阿欧!')
end=time.time()
print('耗时:',end-start)
print('你一共做对了',num,'做错了',10-num)
标签:练习题,randint,random,99,start,num,time,print,除法
From: https://www.cnblogs.com/duoba/p/17177328.html