1. 程式人生 > >python 函數(if & for)

python 函數(if & for)

註意 冒號 elif log python 函數 cond 都是 python amp

函數if & for

if語句寫法:

if condition:

  coding

elif other_condition:

  conding

註意點:

1、if和elif後面的條件之後必需跟 :冒號

2、在:後加入要判斷的語句

for 語句的寫法:

for x in a:

  coding

註意點:

1、for的使用一般都是用來做遍歷

python 函數(if & for)