天天看點

Python程式設計-基礎知識-條件判斷

1. 簡單的if/else條件判斷

judge_flow.py

運作結果:

Please input name: david

Invalid user!

Please input name: master

Hello Master

Please input password: aaa

Wrong password!

Please input password: abc123

Access granted.

2. 多項條件判斷

    elif statements

judge_flow_multiple.py

Input your age: 3

Hi, Baby.

Input your age: 90

Hi Man

Input your age: 1000

Your Majesty