===== 制御構文 ===== ==== 条件分岐 ==== === if === a = 10 if a > 5: print("a > 5") elif a == 5: print("a == 5") else: print("a < 5") if (a > 2) and (a < 8): print("2 < a < 8") ==== ループ処理 ==== === for === for i in range(11): # 0~10まで繰り返し print(i) for i in range(1, 11): # 1~10まで繰り返し print(i) for i in range(1, 11, 2): # 1~10まで増分2(1,3,5,7,9)で繰り返し print(i) === while === i = 0 while i < 10: i += 1 while True: i -= 1 if i == 0: break #ループを抜ける if i % 2: continue # 処理を先頭に戻す