[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/Lovepython015/Python/master/Article/PythonBasis/python5/If.md [Back]  [Original]

#  #


## 1 ##


Python  True  False 

Python  0 null True0  null  False



![if](http://upload-images.jianshu.io/upload_images/2136918-4ee2486190450a1a?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)


## 2if  ##

Python if 

```python
if 
    
else
    
```

Python  `:` 

if >==60:
    print ('')
else :
    print ('')

```



```txt

```

 list  True False

```python
num = 6
if num :
    print('Hello Python')
```



![](http://twowaterimage.oss-cn-beijing.aliyuncs.com/2019-09-07-072713.png)



 `num ` 

![](http://twowaterimage.oss-cn-beijing.aliyuncs.com/2019-09-07-072941.png)

 False   `print('Hello Python')`  

 `:` 

![](http://twowaterimage.oss-cn-beijing.aliyuncs.com/2019-09-07-073432.png)

 Python 


## 3if  ##

 60  90  80  90 

 if 



```python
if 1:
    1
elif 2:
    2
elif 3:
    3
else:
    4
```



```python
# -*-coding:utf-8-*-

results = 89

if results > 90:
    print('')
elif results > 80:
    print('')
elif results > 60:
    print ('')
else :
    print ('')

```



```txt

```


## 4if  ##



 java  python  80 

 `or`   `and` 

or 
 
and 



```python
# -*-coding:utf-8-*-

java = 86
python = 68

if java > 80 and  python > 80:
    print('')
else :
    print('')

if ( java >= 80  and java < 90 )  or ( python >= 80 and python < 90):
    print('')

```



```txt


```

if  and  or  >

Web Proxy Viewer  |  New URL  |  Original Page