1. 程式人生 > >python3.7-初學篇-10

python3.7-初學篇-10

import random
secret = random.randint(1,10)
print('-----------------我愛魚C工作室----------------')
temp = input("不妨猜一下小甲魚現在心裡想的是哪個數字:")
guess = int(temp)
while guess != secret:
  temp = input("哎呀,猜錯了,請重新輸入吧:")
  guess = int(temp)
  if guess == secret:
    print("我草,你是小甲魚心裡的蛔蟲嗎?!")
    print("哼,猜中了也沒有獎勵!")
  else:


    if guess > secret:
      print("哥,大了大了~~~~")
    else:
      print("嘿,小了,小了~~~")
print("遊戲結束,不玩啦^-^")