我的第一个Python程序
程序员文章站
2024-03-23 19:29:52
...
from random import randint
def play():
random_int = randint(0,100)
while True:
user_guess = int(input("What number did we guess(0-100)"))
if user_guess == random_int:
print(f"You found the number({random_int}),Congrats")
break
if user_guess < random_int:
print("Your number is less than the number we guessed.")
continue
if user_guess > random_int:
print("Your number is more than the number we guessed.")
continue
if __name__ == '__main__':
play()
入坑纪念
上一篇: CentOS 6系统启动流程