天天看点

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