2025-8-15

Run Settings
LanguagePython
Language Version
Run Command
# for - repeating time is determined # while() - repeating time is unknown # 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 expession 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 y = [1,2,3,4] for i in y: print(i) # case 2 : range() - range(start, end-1, step) for i in range(0,10,1): print("loop",i) for i in range(4,31,7): #[4,11,18,25] print(i) for i in range(4,31): # step = 1 print(i) for i in range(31): # start = 0, step = 1 print(i) for i in range(30,0,-3): print(i) for i in range(30,33,2): print(i) #sub-list, slice() - 0:10:1 z = [0,1,2,3,4,5,6,7,8,9,10] print(z[0:10:1]) print(z[:6]) # start = 0, 6-1 =5, step =1 print(z[3:1:1]) # empty [] print(z[-1:-4:-1]) a = "hello world" print(a[-1:4:-1])
Editor Settings
Theme
Key bindings
Full width
Lines