{"id":163267,"student_id":1404,"content":"import random\nimport game\n\n# 設定上下界\nup_bound = 100\nlow_bound = 0\n\n# 產生0~100隨機數\nanswer = random.randint(0, 100)\ngame.setBackdrop(\"start.png\")\n\ndef onclick():\n global up_bound, low_bound, answer\n # 輸入猜測值\n value = int(input(\"猜一個數字吧!\"))\n if value \u003c low_bound or value \u003e up_bound:\n game.drawText(\"你猜到範圍外了!!\", 500, 10, 'red', 50)\n stop()\n elif(value \u003e answer):\n up_bound = value\n game.setBackdrop(\"big.png\")\n elif(value \u003c answer):\n low_bound = value\n game.setBackdrop(\"small.png\")\n else:\n up_bound = value\n low_bound = value\n game.setBackdrop(\"bingo.png\")\n stop()\n \n \ndef loop():\n # 顯示上下界範圍\n #game.drawText(顯示內容, x, y, 顏色, 大小)\n game.drawText(low_bound, 500, 770, 'red', 90)\n game.drawText(\"-\", 600, 770, 'black', 90)\n game.drawText(up_bound, 700, 770, 'green', 90)\n \n# loop()\nforever(loop)\non(\"click\", onclick)\n\n\n\n\n\n# import random\n\n# low_bound = 0\n# up_bound = 100\n\n# answer = random.randint(low_bound, up_bound)\n\n# setBackdrop(\"start.png\")\n\n# def onclick():\n# global up_bound, low_bound\n \n# guess = int(input(\"輸入數值\"+str(low_bound)+\"~\"+str(up_bound)))\n \n# if guess \u003e low_bound and guess \u003c up_bound: \n# if guess \u003e answer:\n# up_bound = guess\n# setBackdrop(\"big.png\")\n \n# if guess \u003c answer:\n# low_bound = guess\n# setBackdrop(\"small.png\")\n \n# if guess == answer:\n# low_bound = answer\n# up_bound = answer\n# setBackdrop('bingo.png')\n\n# def loop():\n# drawText(low_bound, 500, 770, 'black', 90)\n# drawText('-', 640, 770, 'black', 90)\n# drawText(up_bound, 720, 770, 'black', 90)\n\n# forever(loop)\n# on(\"click\", onclick)\n","created_at":"2020-07-09T11:04:40.882+08:00","updated_at":"2020-07-20T14:41:10.932+08:00","name":"終極密碼_S 副本","language":"python","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/163267/6ff98553b0678f8b9ad0e3dfb3dcb233.jpg"},"parent_id":162825,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":69,"hashid":"zpesn282","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2836545,"file_name":"start.png","project_id":163267,"asset_id":231968,"created_at":"2020-07-09T11:04:40.887+08:00","updated_at":"2020-07-09T11:04:40.887+08:00"},{"id":2836546,"file_name":"small.png","project_id":163267,"asset_id":231967,"created_at":"2020-07-09T11:04:40.888+08:00","updated_at":"2020-07-09T11:04:40.888+08:00"},{"id":2836547,"file_name":"bingo.png","project_id":163267,"asset_id":231966,"created_at":"2020-07-09T11:04:40.889+08:00","updated_at":"2020-07-09T11:04:40.889+08:00"},{"id":2836548,"file_name":"big.png","project_id":163267,"asset_id":231965,"created_at":"2020-07-09T11:04:40.890+08:00","updated_at":"2020-07-09T11:04:40.890+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦