Python-if 语句
来源:互联网 发布:贝太厨房软件 编辑:程序博客网 时间:2024/06/08 15:21
一、if语句
1. 作用: 条件判断
2. 格式: if 判断条件:
执行语句1
else:
执行语句2
意思是: 如果条件成立,执行语句1,不成立,执行语句2;
或者 if 判断条件1:
执行语句1
elif 判断条件2:
执行语句2
else:
执行语句3
意思是: 如果条件1成立,执行语句1,跳出if语句,如果不成立,判断条件2,如果成立,执行语句2,否则,执行语句3.
具体事例:
a=3if a<-1: print ('a<0')elif a==0: print ('a=0')else: print ('a>0')结果为:
a>0
阅读全文
0 0
- Python的if语句
- Python-if语句
- python if语句语法
- python if语句
- Python-if语句
- Python学习:if语句
- Python-if语句
- python的if语句
- Python之if语句
- python if 语句
- Python if 语句
- Python if语句
- Python if 语句
- python之if语句
- Python-if 语句
- Python if语句
- if语句(python)
- python if语句使用
- spring配置错误Multiple annotations found at this line
- 10-21笔试题
- Android属性动画与自定义控件画圆球移动
- Delphi 实现卸载Windows应用程序(类似360软件管家-卸载程序)
- Dubbo 简单demo
- Python-if 语句
- Mac OS X搭建C#开发环境
- 深入理解C++中public、protected及private用法
- windows利用putty+vnc远程连接问题!
- NDP与ARP的区别
- loadrunner Vuser发生器 recording Options
- TX1制作镜像用于备份和恢复
- tf.reshape()
- iOS程序崩溃[Thread 1: signal SIGABRT] / [Image Not Found]错误