""" Version: 0.1 Author: freshbin Date: 2019年8月20日 """ print("=================================if语句 start================================================") number = 23 guess = int(input('Enter an interger : ')) if guess == number: print('Congratulations, you guessed it.') elif guess < number: print('No, it is a little higher than that.') else: print('No, it is a little lower than that.') print('Done.') print("=================================if语句 end================================================") print("=================================while语句 start================================================") number = 23 running = True while running: guess = int(input('Enter an interger')) if guess == number: print('Congratulations, you guessed it.') 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.') print('Done') print("=================================while语句 end================================================") print("=================================for语句 start================================================") for i in range(1, 5): print(i) else: print('The for loop is over.') print("=================================for语句 end================================================") print("=================================break语句 start================================================") while True: s = input('Enter something:') if s == 'quit': break print('Length of the string is ', len(s)) print('Done.') print("=================================break语句 end================================================") print("=================================continue语句 start================================================") while True: s = input('Enter something : ') if s == 'quit': break if len(s) < 3: print('Too small') continue print('Input is of sufficient length') print("=================================continue语句 end================================================")
python学习-第三篇
最新推荐文章于 2024-04-28 02:04:57 发布