我是靠谱客的博主 沉默酒窝,这篇文章主要介绍用python写猜数字游戏,现在分享给大家,希望可以做个参考。

import random

number = random.randint(1, 100)
guess = 0

while guess != number:
    guess = int(input("Guess a number between 1 and 100: "))
    if guess > number:
        print("Too high!")
    elif guess < number:
        print("Too low!")
    else:
        print("You got it!")

最后

以上就是沉默酒窝最近收集整理的关于用python写猜数字游戏的全部内容,更多相关用python写猜数字游戏内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(95)

评论列表共有 0 条评论

立即
投稿
返回
顶部