以缩进符和冒号标志语块:

 

#!/usr/bin/python
#Filename: if.py

number = 23
running = True

while running:
    guess = int(input('Enter an integer : '))

    if guess == number:
        print('Congratulations,you guessed it.')
        print('(but you do not win any prizes!)')
        running = False
    elif guess < number:
        print('No,it is a little higher than that')
    else:
        print('No,it is a little lower than that')
else:
    print('the while loop is over.')

Python3的WHILE,IF例句

相关文章:

  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2021-06-28
  • 2021-08-30
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
猜你喜欢
  • 2021-05-14
  • 2022-12-23
  • 2021-09-12
  • 2021-07-08
  • 2022-12-23
  • 2021-05-24
相关资源
相似解决方案