{"id":169549,"student_id":3232,"content":"import game\nimport random\nimport time\n\ncorrect = 0\nfinish = 200\nt_s = time.time()\n# 建立字母串列\nw = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']\n# 紀錄遊戲開始時間\n\n# 隨機挑選字母\nen = w[random.randint(0, len(w) - 1)]\n\ndef main():\n # global\n global w, en, correct, finish\n # 顯示\n game.draw_text(en, 300, 300, \"black\", 150)\n # 按鍵按下\n if key.a and en == 'a':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.b and en == 'b':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.c and en == 'c':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.d and en == 'd':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.e and en == 'e':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.f and en == 'f':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.g and en == 'g':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.h and en == 'h':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.i and en == 'i':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.j and en == 'j':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.k and en == 'k':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.l and en == 'l':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.m and en == 'm':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.n and en == 'n':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.o and en == 'o':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.p and en == 'p':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.q and en == 'q':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.r and en == 'r':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.s and en == 's':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.t and en == 't':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.u and en == 'u':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.v and en == 'v':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.w and en == 'w':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.x and en == 'x':\n en = w[random.randint(0, len(w) - 1)] \n correct += 1\n if key.y and en == 'y':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n if key.z and en == 'z':\n en = w[random.randint(0, len(w) - 1)]\n correct += 1\n t = time.time() - t_s\n t = round(t, 2) \n game.draw_text(\"進度\" + str(correct/finish*100) + \"%\", 700, 650, \"black\", 100)\n game.draw_text(str(t) + \" s\", 700, 800, \"black\", 100)\n # 遊戲終止\n if correct == finish:\n game.stop()\ngame.forever(main)","created_at":"2020-07-23T08:54:09.239+08:00","updated_at":"2020-07-23T09:49:21.653+08:00","name":"英打練習_S 副本","language":"python","screenshot":{"url":"https://cdn4.koding.school/uploads/project/screenshot/169549/d8c720a25b67d91b79ac9a01d5915447.jpg"},"parent_id":162860,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":43,"hashid":"yeys6ymw","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦