第一個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!')