python的条件分支语句(if)
2014-10-16 11:33
387 查看
Python的条件分支语句语法JAVA和C略有不同使用 if 条件语句:的形式:
条件判断表达式: 布尔表达式 非0即真。
if 1:
print 'true'
else:
print 'false'
<span style="font-size:14px;">count = int(raw_input("please input your math record:")) print count if count > 90: print 'a' elif count > 80: print 'b' elif count > 70: print 'c' elif count > 60: print 'd' else: print 'e' print 'end' sex = raw_input("please input your sex:") if sex == 'mail': print 'gentleman!' else: print 'lady!' print 'end'</span>
条件判断表达式: 布尔表达式 非0即真。
if 1:
print 'true'
else:
print 'false'
if 109: print 'true' else: print 'false'
if 'Hello': print 'true' else: print 'false'结果全是true
相关文章推荐
- Python中的条件分支语句,if , else , else if
- Python 【条件分支】(if 语句) 学习笔记
- Python学习入门基础教程(learning Python)--3.1Python的if分支语句
- Python基础6- 流程控制之if条件语句
- Shell编程中if-elif-else条件分支语句测试
- Matlab编程与数据类型 -- 多分支条件选择语句if/elseif/…/else/end
- java基础之 “if ”条件分支语句和switch开关语句
- Python学习入门基础教程(learning Python)--3.1Python的if分支语句 .
- DayDayUP_Python自学记录[3]_Python条件判断语句(if while for)
- Python基础1:if条件判断 break/continue语句
- Python if和for条件语句
- Matlab编程与数据类型 -- 分支条件选择语句if/end
- 零基础学python-2.10 条件判断 if语句
- python 列表处理,for循环语句,if条件判断
- Python中如何避免使用多个分支语句(多个if和else)——函数字典(Function Map)简介
- 25_Shell语言――――if条件判断之组合判断(与、或、非)和多分支if语句
- 零基础学python-2.10 条件判断 if语句
- Python成长之路第一篇(4)_if,for,while条件语句
- python基础------if条件语句
- Python新手学习基础之条件语句——if/else语句