x = -1
if(x > 0):
print("x is larger than 0")
x = x + 1
elif (x==0) :
print("x is equal to 0")
x = x - 1
else :
print("x is less than 0")
print (x)
# for - repeating time is datermined
# while () - repeating time is unkown
# case 1 : controller inside while loop
x = 1
while(True):
print(x)
x = x + 1
# add a controller
if ( x == 3 ):
print(x)
continue
x = x + 1
if (x == 7 ):
break
else :
print("loop exit normally")
# case 2 : controller at while conditional expression
while (x < 10):
print("second while loop:", x)
x = x + 1
else:
print("second loop exit normally")
## for : loop iterable , range() , list[], tuple
# case 1 : loop a list/ tuple
y = [1,2,3,4]
for i in y:
if(i == 3):
continue
print (i)
# case 2 : range() - range( start , end-1, step )
for i in range(0, 10,1):
print("loop",i)
for i in range(0,10,3):
print(i)