#!/usr/bin/python
# -*- coding: UTF-8 -*-
# 例2:elif用法
num = 5
if num == 3: # 判断num的值
print 'boss'
elif num == 2:
print 'user'
elif num == 1:
print 'worker'
elif num < 0: # 值小于零时输出
print 'error'
else:
print 'roadman' # 条件均不成立时输出
Python基础-条件语句
最新推荐文章于 2022-04-07 21:32:16 发布