1.for循环 #!/usr/bin/evn python #Filename: for.py for i in range(1, 5): print i else: print ‘The for loop is over‘ 2.break语句 #!/usr/bin/evn python #filename: break.py while True: s = raw_input(‘Enter something : ‘) if s == ‘quit‘: break print ‘Length of the string is‘, len(s) print ‘Done‘ 3.continue语句 #!/usr/bin/evn python #filename: continue.py while True: s = raw_input(‘Enter something:‘) if s == ‘quit‘: break if len(s) < 3: continue print ‘Input is of sufficient length‘
时间: 2024-12-14 16:22:07