我又进入了python的坑,分享一段,我写的一段python游戏代码【猜数字游戏·无限次】
# name:da我又进入了python的坑,分享一段,我写的一段python游戏代码【猜数字游戏·无限次】
# name:dai
# time:2021-11-29
# 这是一个「猜数字游戏·不限次数」
import random
a = random.randint(1,1000)
b = int(input('I`m thinking of a number! Try to guess the number I`m thinking of :'))
while True:
c = a
if b < c:
b = int(input('Too low! Guess again:'))
if b > c:
b = int(input('Too big! Guess again:'))
if b == c:
d = input(('That`s it! Would you like to play again? (yes/no)'))
if d == 'no':
print('Thanks for playing!')
break
if d == 'yes':
b = (int(input('I`m thinking of a number! Try to guess the number I`m thinking of :')))
a = random.randint(1,1000)...代亚冲