{"id":182707,"student_id":3760,"content":"import game #載入遊戲框架\nimport random\n\n# 設定上下界\nup_bound = 100\nlow_bound = 0 \n\n# 產生0~100隨機數\nrand_num = random.randint(low_bound, up_bound)\n\ngame.set_backdrop(\"start.png\")\n\ndef onclick():\n global up_bound, low_bound\n \n # 輸入猜測值\n guess = int(input(\"輸入數值 \" + str(low_bound) + \"~\" + str(up_bound)))\n # 判斷猜測值是否在上下界範圍內\n if guess \u003e low_bound and guess \u003c up_bound:\n # 及判斷猜測值與密碼是否相等\n if guess \u003e rand_num:\n up_bound = guess\n game.set_backdrop(\"big.png\")\n if guess \u003c rand_num:\n low_bound = guess\n game.set_backdrop(\"small.png\")\n if guess == rand_num:\n up_bound = guess\n low_bound = guess\n game.set_backdrop(\"bingo.png\")\n # 更新上下界\n\ndef loop():\n # 顯示上下界範圍\n game.draw_text(low_bound, 500, 700, \"black\", 70)\n game.draw_text(\"~\", 575, 700, \"black\", 70)\n game.draw_text(up_bound, 650, 700, \"black\", 70)\n\ngame.forever(loop)\ngame.on(\"click\", onclick)\n","created_at":"2020-08-18T14:34:53.167+08:00","updated_at":"2020-08-18T15:49:42.767+08:00","name":"終極密碼_S 副本 副本","language":"python","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/182707/90d995030b9b6eb54b24f1ce9afcc74f.jpg"},"parent_id":182704,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":88,"hashid":"36ysvpwr","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3109907,"file_name":"big.png","project_id":182707,"asset_id":231965,"created_at":"2020-08-18T14:34:53.172+08:00","updated_at":"2020-08-18T14:34:53.172+08:00"},{"id":3109908,"file_name":"bingo.png","project_id":182707,"asset_id":231966,"created_at":"2020-08-18T14:34:53.173+08:00","updated_at":"2020-08-18T14:34:53.173+08:00"},{"id":3109909,"file_name":"small.png","project_id":182707,"asset_id":231967,"created_at":"2020-08-18T14:34:53.174+08:00","updated_at":"2020-08-18T14:34:53.174+08:00"},{"id":3109910,"file_name":"start.png","project_id":182707,"asset_id":231968,"created_at":"2020-08-18T14:34:53.181+08:00","updated_at":"2020-08-18T14:34:53.181+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
繁中
简中
English
日本語
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦