File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed
Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change 33import time
44
55print ("贴贴我的百花酱!数字打字练习\n " )
6- print ("程序会随机生成若干组0至99999999的整数 ,每输入一组按回车键继续;要结束练习,请输入-1并回车。" )
6+ print ("程序会随机生成若干组指定位数的整数 ,每输入一组按回车键继续;要结束练习,请输入-1并回车。" )
77print ("练习结束后会显示所用时间、完成数目和输入速度,并列出输入错误的数字。\n " )
8- input ("按回车键开始:" )
8+ num_len = int ( input ("请输入要生成的随机数位数,练习会立即开始:" ) )
99
1010wrongList = []
1111sum = 0
1212start_time = time .time ()
1313while True :
14- target = random .randint (0 , 99999999 )
14+ target = ""
15+ for i in range (num_len ):
16+ target = target + str (random .randint (0 ,9 ))
1517 print (str (target )+ ": " , end = '' )
16- answer = int ( input () )
17- if answer == - 1 :
18+ answer = input ()
19+ if answer == "-1" :
1820 break
1921 sum += 1
2022 if target != answer :
2527print ("\n 错误列表:" )
2628print ("正确答案\t 你的输入" )
2729for wrongNum in wrongList :
28- print (str ( wrongNum [0 ]) + "\t " + str ( wrongNum [1 ]) )
30+ print (wrongNum [0 ] + "\t " + wrongNum [1 ])
2931used_time = end_time - start_time
3032print ("\n 练习" + str (sum ) + "个,错误" + str (len (wrongList )) + "个,用时" + str (int (used_time )) + "秒,有效平均速度为每分钟" + str (format (float ((sum - len (wrongList ))/ (used_time / 60 )), '.1f' )) + "个。\n " )
3133
Original file line number Diff line number Diff line change 1+ @ title pyinstaller -F .\NumTypeExer.py
2+ @ echo off
3+
4+ if exist .\build (
5+ del /q .\build
6+ )
7+ if exist .\dist (
8+ del /q .\dist
9+ )
10+ if exist .\NumTypeExer.spec (
11+ del /q .\NumTypeExer.spec
12+ )
13+
14+ pyinstaller -F .\NumTypeExer.py
You can’t perform that action at this time.
0 commit comments