欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

我的第一个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()

入坑纪念

相关标签: Python