Programming Paradigm 概念
Eleanor Thomas
Senior Data Analytics Engineer
if/else 敘述for 迴圈與 while 迴圈def 定義函式
if my_height > your_height:
print("I'm taller!")
for height in height_list:
print(height)
合併應用:
for height in height_list:
if my_height > height:
print("I am taller than ", height)
def compare_heights(my_height, height_list): for height in height_list: if my_height > height: print("I am taller than ", height) returnmy_height = 63 height_list = [62, 67, 70]compare_heights(my_height, height_list)
if 敘述、迴圈與 Python 函式實作這些邏輯
Programming Paradigm 概念