{"id":884487,"student_id":10,"content":"from game import *\nimport random\n\nset_backdrop('black') # 黑色背景\nanswer = random.randint(1, 100) # 產生答案\nprint(answer) # 印在主控台測試用\n\ntext = '點擊畫面猜 1 - 100 數字' # 顯示文字\ncount = 0 # 猜的次數\n\ndef guess():\n global text, count\n g = int(input())\n if g \u003e answer: text = '結果:猜太大了'\n if g \u003c answer: text = '結果:猜太小了'\n if g == answer: text = '結果:猜對了'\n count += 1\n \ndef loop():\n draw_text(text, 100, 100, 'black', 50)\n draw_text('猜的次數: ' + str(count), 100, 170, 'black', 30)\n\non('click', guess) # 點擊畫面執行 guess 函式\nforever(loop) # 不斷執行遊戲迴圈","created_at":"2024-11-13T15:11:26.582+08:00","updated_at":"2024-11-15T16:54:04.728+08:00","name":"延伸挑戰_例外處理","language":"python","screenshot":{"url":"https://cdn2.koding.school/uploads/project/screenshot/884487/ce8b76540c51feaee3dc13c0079a93a3.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":4,"hashid":"zpes8e42g","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦