心算測驗。
心算測驗不用準備題庫,只要產生亂數就可以。以下程式,可產生10題1位數心算。
import random
import time
r=0
w=0
t1=int(time.time())
for i in range(10):
a=random.randint(1,9)
b=random.randint(1,9)
c=a+b
d=int(input('%d :%2d+%2d='% (i+1,a,b)))
if d==c :
r=r+1
else:
w=w+1
t2=int(time.time())
t=t2-t1
print('The right answer is:%d'% r)
print('The wrong answer is:%d'% w)
print('total time=%d second'% t)
1:4+ 4=8 2:7+ 4=11 3:9+ 4=
| ID | User | Problem | Subject | Hit | Post Date |
沒有發現任何「解題報告」 |
|||||