initialize 发表于 2022-11-10 22:02:22

练习发帖

import random

answer = random.randint(1,10)
counts = 3
while counts > 0 :
    temp = input("请输入小甲鱼心里想的数字:")
    guess = int(temp)
    if guess == answer :
      print("答对了,真牛逼!")
      break
    else :
      if guess > answer :
            print("数字大了!")
      else :
            print("数字小了!")
    counts = counts - 1
print("游戏结束,古德拜!")
页: [1]
查看完整版本: 练习发帖