Python学习(3)——if语句
2014-04-15 16:40
288 查看
虽然在之前接触过C、C++、Java等,但是还是觉得Python写出来的好看o(≧v≦)o~,简洁明了!
if语句的嵌套
python中没有switch语句, switch可以使用if...elif...else实现。
if, elif, else之后必须要有冒号(:), 之后的代码需要增加一层缩进。
score = raw_input("score:") score=int(score) if(score >= 90) and (score <= 100): print "A" elif(score >= 80) and (score < 90): print "B" elif(score >= 60) and (score < 80): print "C" else: print "D"
if语句的嵌套
i = 5 if i > 1: print 'i bigger than 1' print 'good' if i>2: print 'i bigger thatn 2' print 'even better'
python中没有switch语句, switch可以使用if...elif...else实现。
if, elif, else之后必须要有冒号(:), 之后的代码需要增加一层缩进。
相关文章推荐
- 学习Python语言---If语句
- python基础学习(四)if判断语句
- Python新手学习基础之条件语句——if/else语句
- python控制流语句if、while、for、break、contnue的学习———ubuntu下python的学习(2)
- Python学习入门基础教程(learning Python)--3.2 if-else分支语句
- Python学习--控制语句:if, while, for, break, continue
- Python学习入门基础教程(learning Python)--3.1Python的if分支语句
- Python学习:if语句
- Python学习笔记四:if语句
- Python基础,基本类型(整型,浮点数等)数据结构(List,dic(Map),Set,Tuple),控制语句(if,for,while,continue or break):来自学习资料
- Python学习第三周第一次作业——if语句
- Python新手学习基础之条件语句——if/else语句
- Python学习_我要使用if判断语句
- Python学习笔记(二):if语句的使用
- Python学习入门基础教程(learning Python)--3.1Python的if分支语句 .
- Python学习笔记(4)-if语句
- Python 【条件分支】(if 语句) 学习笔记
- Python学习笔记之if语句的使用示例
- Python学习入门基础教程(learning Python)--3.2 if-else分支语句 .
- python 学习笔记 if语句