Python简单while循环猜数
temp = input(‘please guess a number:’)#引入交互数temp
guess = int(temp)#赋值参数
while guess != 8:#while循环
if guess < 8:
print(‘too small!’)
temp = input(‘please guess again:’)
guess = int(temp)
else:
print(‘too big!’)
temp = input(‘please guess again:’)
guess = int(temp)
print(‘guess right!’)
print(‘game over!’)