-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c4ccb6
commit 31fff21
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/python3 | ||
import random | ||
import time | ||
|
||
print("贴贴我的百花酱!数字打字练习\n") | ||
print("程序会随机生成若干组0至99999999的整数,每输入一组按回车键继续;要结束练习,请输入-1并回车。") | ||
print("练习结束后会显示所用时间、完成数目和输入速度,并列出输入错误的数字。\n") | ||
input("按回车键开始:") | ||
|
||
wrongList = [] | ||
sum = 0 | ||
start_time = time.time() | ||
while True: | ||
target = random.randint(0, 99999999) | ||
print(str(target)+": ", end='') | ||
answer = int(input()) | ||
if answer == -1: | ||
break | ||
sum += 1 | ||
if target != answer: | ||
wrongNum = (target, answer) | ||
wrongList.append(wrongNum) | ||
end_time = time.time() | ||
|
||
print("\n错误列表:") | ||
print("正确答案\t你的输入") | ||
for wrongNum in wrongList: | ||
print(str(wrongNum[0]) + "\t" + str(wrongNum[1])) | ||
used_time = end_time - start_time | ||
print("\n练习" + str(sum) + "个,错误" + str(len(wrongList)) + "个,用时" + str(int(used_time)) + "秒,有效平均速度为每分钟" + str(format(float((sum-len(wrongList))/(used_time/60)), '.1f')) + "个。\n") | ||
|
||
print("加油呀,爱你喔~\n") | ||
input("按回车键退出……") |