我的一堂Python課
import random num = random.randint(1, 100) while True: print('Guess a number between 1 and 100') guess = input() i = int(guess) print(i) if i == num: print('You won!!!') break elif i < num: print('Try Higher') elif i > num: print('Try Lower') #any recommendations for the game end print('if you gussed less than 6 times you won')
Run
Clear
Output: