用Python实现一个简单的猜数字游戏
import random number = int(random.uniform(1,10)) attempt = 0 while (attempt < 3): m = int(input('Please try to guess the number!')) if m == number: print('bingo!') break elif m < number: print('Your answer is smaller!') attempt += 1 else: print('Your answer is bigger!') attempt += 1 else: print(' Your try has run out!\n','game over')