Python程序--猜数游戏

import random
x=random.randint(1,100)
print('-----猜数游戏-----')
guess=0
while guess!=x:
    temp=input('猜数开始,请输入:')
    guess=int(temp)
    if guess > x:
        print('大了')
    if guess < x:
        print('小了')
if guess==x:
        print('猜数正确')
print('-----游戏结束-----')

原文地址:https://www.cnblogs.com/cylf/p/10567285.html