Python learning notes (1), python learning notes
#! /Usr/bin/eny python #! -*-Coding: UTF-8-*-"import timea1 = Truewhile a1: print ('1') time. sleep (3) a1 = Falseprint ('end') "" # an integer in 10 of the output ratio. # Break is used to jump out of a loop. "" A1 = Truenub = 1 while a1: print (nub) if nub = 10: a1 = False nub = nub + 1 print ('end ') "" # the first job of the food ratio, cyclically input an integer from 1 to 10, "" nub = 1 while True: print (nub) if nub = 10: break nub = nub + 1 print ('output 1-10 integers ') # The first job of the ratio of food to vegetable. The second method is a = 1 while a <= 11: if! = 10: print (a) a = 1 + a "" # The total number of all numbers in the ratio of "1" to "--100. "" Sum = 0nub = 1 while True: sum = sum + nub if nub = 100: break nub = nub + 1 print (sum) print ('sum of output values 1-') "" # an odd number of output values 1. Output an even number and set nub to 2. "" Sum = 0nub = 1 while True: print (nub) if nub> = 99: break nub = nub + 2 "# an odd number of 1-output from the ratio of food to vegetables, use the remainder. # Nub % 2 = 1 is the remainder, = 2 is the even number, after Division 2, the remainder is 1 is the odd number, except 2 is the even number. "Nub = 1 while nub <= 100: if nub % 2 = 1: print (nub) nub = nub + 1 """