if1 <= a <= 100: print('你好') elif a and (not b): print('你好1') else: if b: print('wow') else: print('now')
match a: case1 | 3: print('1') case2: print('2')
######
''' import time # 0 ~ 99 for _ in range (100): # empty, only repeat time.sleep(1) # 1s for i in range (0, 100, 2): # even number time.sleep(0.01) print(sum(range(1, 3, 0.1))) '''
######
while a <= 15: a += 1 if a > 20: break elif a > 25: continue
######
import random
a = random.randrange(1, 101)
######
items1 = [1, 1.1, '1', True] items2 = list(range(1, 11)) items3 = list('hello') # h e l l o print(items1 + items2 + items3 * 2) print(2notin items1) # False print(items1[0], items1[-1]) # forward subscript 0 ~ 4 is equal to reversed subscript -5 ~ -1 print(items1[0:5:2]) # range [0,5), span is 2, namely 0, 2, 4, they can also be negative print(items1[:], items1[::]) # acquiescently 0, ending, 1 # such options can also be used to modify lists
# lists can be compared, like ==, !=, <= ..., the rule is comparing each elements one by one(parallel[adv])
# type 1 to traverse each one: for i inrange(len(items1)): print(items1[i], end = ' ') # type 2: for item in items1: print(item, end = " ")