{"id":162859,"student_id":2589,"content":"import game\nimport random\nimport time\n\n\nalphabets = ['a', 'b', 'c', 'd', 'e', \n 'f', 'g', 'h', 'i', 'j',\n 'k', 'l', 'm', 'n', 'o', \n 'p', 'q', 'r', 's', 't', \n 'u', 'v', 'w', 'x', 'y', \n 'z']\n\nt_s = time.time()\nalphabet = random.randint(0, len(alphabets)-1)\ncorrect = 0\nfinish = 200\n\n \ndef print_text(alphabet, correct):\n global t_s, alphabets, finish\n game.draw_text(alphabets[alphabet], 300, 300, 'black', 90)\n game.draw_text(time.time()-t_s, 600, 700, 'black', 90)\n game.draw_text(\"進度\"+str(correct*100/finish)+\"%\", 600, 600, 'black', 90)\n\ndef key_press(alphabet, correct):\n global alphabets\n if key.a and alphabets[alphabet] == 'a':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.b and alphabets[alphabet] == 'b':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.c and alphabets[alphabet] == 'c':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.d and alphabets[alphabet] == 'd':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.e and alphabets[alphabet] == 'e':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.f and alphabets[alphabet] == 'f':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.g and alphabets[alphabet] == 'g':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.h and alphabets[alphabet] == 'h':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.i and alphabets[alphabet] == 'i':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.j and alphabets[alphabet] == 'j':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.k and alphabets[alphabet] == 'k':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.l and alphabets[alphabet] == 'l':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.m and alphabets[alphabet] == 'm':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.n and alphabets[alphabet] == 'n':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.o and alphabets[alphabet] == 'o':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.p and alphabets[alphabet] == 'p':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.q and alphabets[alphabet] == 'q':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.r and alphabets[alphabet] == 'r':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.s and alphabets[alphabet] == 's':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.t and alphabets[alphabet] == 't':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.u and alphabets[alphabet] == 'u':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.v and alphabets[alphabet] == 'v':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.w and alphabets[alphabet] == 'w':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.x and alphabets[alphabet] == 'x':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.y and alphabets[alphabet] == 'y':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n if key.z and alphabets[alphabet] == 'z':\n alphabet = random.randint(0, len(alphabets)-1)\n correct += 1\n return alphabet, correct\n\ndef main():\n global alphabet, t_s, correct, finish, alphabets\n print_text(alphabet, correct)\n alphabet, correct = key_press(alphabet, correct)\n \n if correct == finish:\n stop()\n\ngame.forever(main)\n","created_at":"2020-07-06T01:54:55.883+08:00","updated_at":"2020-07-12T16:03:10.400+08:00","name":"英打練習(函式)_T ","language":"python","screenshot":{"url":null},"parent_id":160547,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":89,"hashid":"882sp9dj","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦