python中if else流程判断
2018-04-09 13:42
471 查看
1、python中实现密码密文输入
2、if 判断
(1)、
(2)、猜年龄
#Note:
if 条件判断:
...
elif 条件判断:
...
else:
...
#!/usr/bin/env python import getpass #调用getpass模块就能实现密码密文显示 username=input("username:") userpasswd=getpass.getpass("userpasswd:") print(username,userpasswd)
2、if 判断
(1)、
#!/usr/bin/env python _username = "lijinzhu" _userpasswd = "abc123" username = input("username:") userpasswd = input("userpasswd:") if _username == username and _userpasswd == userpasswd: print("Welcome usr {name} login...".format(name=username)) else: print("Invalid username or passwd!")
(2)、猜年龄
#!/usr/bin/env python _age = 18 age = int(input("age:")) if _age == age: print("right") elif _age > age: print("think smaller...") else: print("think strong...")
#Note:
if 条件判断:
...
elif 条件判断:
...
else:
...
相关文章推荐
- python 3 if else 流程判断示例
- python之路-day1-if...else...流程判断
- 【Python语法笔记】if else 流程判断
- 小Y的Python学习日志--流程控制(if 条件判断)
- python条件判断 if else
- Python中条件判断 if, elif, else的使用
- Python基础(条件判断和循环) if elif else for while break continue;
- python -- 02 流程控制(1)if else
- Oracle PLSQL Demo - 03.流程判断[IF ELEIF ELSE]
- Python 三元条件判断表达式(and or/if else)
- Python的Whiel循环和if流程判断
- python流程控制语句 ifelse - 2
- python流程控制语句 ifelse - 4
- Python中的判断、循环 if...else,while
- python流程控制语句 ifelse - 1
- Python流程控制语句->if .......else
- Python中的流程控制--if判断语句
- Python流程控制语句->if .......else
- Python学习笔记——if,else流程判断
- python流程控制语句 ifelse - 3