{"id":169625,"student_id":139,"content":"import game\nimport random\nimport time\n\n# 建立字母串列\nalphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', \n'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']\ncorrect = 0\nfinish = 100\n# 紀錄遊戲開始時間\n\n# 隨機挑選字母\nalphabet = alphabets[random.randint(0,len(alphabets)-1)]\nstartTime = time.time()\ndef main():\n detect_key_down()\n showInfo()\n \n if correct == finish:\n game.stop()\ndef detect_key_down():\n global alphabet, correct\n if key.a and alphabet == 'a':\n correct +=1 \n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.b and alphabet == 'b':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.c and alphabet == 'c':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.d and alphabet == 'd':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.e and alphabet == 'e':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.f and alphabet == 'f':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.g and alphabet == 'g':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.h and alphabet == 'h':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.i and alphabet == 'i':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.j and alphabet == 'j':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.k and alphabet == 'k':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.l and alphabet == 'l':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.m and alphabet == 'm':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.n and alphabet == 'n':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.o and alphabet == 'o':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.p and alphabet == 'p':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.q and alphabet == 'q':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.r and alphabet == 'r':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.s and alphabet == 's':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.t and alphabet == 't':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.u and alphabet == 'u':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.v and alphabet == 'v':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.w and alphabet == 'w':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.x and alphabet == 'x':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.y and alphabet == 'y':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n if key.z and alphabet == 'z':\n correct +=1\n alphabet = alphabets[random.randint(0,len(alphabets)-1)]\n\ndef showInfo():\n global alphabet, correct, finish, startTime\n # 顯示\n game.drawText(alphabet, 300,300,\"black\", 90)\n game.drawText(\"Progress: \"+str(correct)+\"/\"+str(finish), 500,300,\"#020203\", 90)\n _time = (time.time() - startTime)*100//1/100\n game.drawText(\"TIME: \"+str(_time), 100,600,\"red\",80)\n\n\n\n\n\n\n\n\n\n\ngame.forever(main)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","created_at":"2020-07-23T09:27:21.714+08:00","updated_at":"2020-07-23T11:22:05.136+08:00","name":"英打練習_S 副本","language":"python","screenshot":{"url":"https://cdn6.koding.school/uploads/project/screenshot/169625/78c61e7f1ead7988a942b4dbd445e807.jpg"},"parent_id":162860,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":191,"hashid":"gk4sej9w","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
繁中
简中
English
日本語
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦