1Yueer = 182Count =03 whileCount < 3:4yueerage = Int (input ('How big is yue son:'))5 ifYueerage = =Yueer:6 Print('congratulations on your guess. ')7 Break8 elifYueerage >Yueer:9 Print('you guessed it too much. ')Ten elifYueerage <Yueer: One Print('a little bigger.') ACount + = 1 - ifCount ==3: -Count_jixu = input ('continue y, do not continue N:') the ifCount_jixu = ='Y': -Count =0 - elifCount_jixu = ='N': -Count = 3 + Else: - Print("Fuck off")
Approximate usage of while loop, English poor--...
There is also a for loop, with the following specific usage:
for in range (3): print(a)
Print a can be printed out in a.
Range (10) to print out the 1,2,3,4......10.
What if I want to print an even number?
The For loop also has a trick that can be set from when the loop starts, when it ends, how many times the loop is done, specifically as follows:
for in range (0,10,2): print(a)
0
2
4
6
8
Rang (0,10,2):
The first two bits represent a range of 0 to 10 loops, followed by a loop interval.
Python with Learn-write (while loop and for loop)