第一个Python代码——猜数字
最近有打算学习Python,今天看了看Python编程从入门到实践的前两章,动手编了一下书前言中作者Eric Matthes在儿童时期编写的猜数字的程序
number = 23
running = True
while running:
guess = int(input('Please Input A Number:'))
if guess == number:
print('Congratulations, You Guessed It.')
cond = input('Would You Like Play Again?(Yes/No):')
if cond.lower() == 'yes':
running = True
print('Guess Gaming Continue...')
else:
running = False
elif guess > number:
print('No, It Is A Little Higher Than True .')
else:
print('No, It Is A Little Lower Than True.')
else:
print('Thanks For Playing!')