python if else elif statement
name = input('what is your name?')
if name.endswith('zd'):
print("hello panzidong")

name = input('what is your name?')
if name.endswith('zd'):
print("hello panzidong")
else:
print("hello other")

num = input('Enter a number:')
if int(num)> 0:
print('the number is positive')
elif int(num) < 0:
print('the number is negative')
else:
print('the number is zero')

python if else elif statement的更多相关文章
- Python tricks(4) -- with statement
简介 with是从2.5版本引入的一个语法. 这个语法本身是为了解决try..finally繁琐的释放各类资源(文件句柄, Lock等)的问题. 如果想在旧版本中使用这个功能, 直接引入future模 ...
- Python基础(条件判断和循环) if elif else for while break continue;
条件判断 计算机之所以能做很多自动化的任务,因为它可以自己做条件判断. 比如,输入用户年龄,根据年龄打印不同的内容,在Python程序中,用if语句实现: age = 20 if age >= ...
- python入门:if、elif、else 条件语句的基本用法
#!/usr/bin/env python # -*- coding:utf-8 -*- #elif(否则如果,译音:埃尔夫)eise(否则,译音:埃尔斯) #if.elif.else 条件语句的基本 ...
- [Python] Symbol Review
From:http://learnpythonthehardway.org/book/ex37.html 1. with X as Y: pass 1.1 yield 2. exec 2.1 name ...
- 写出简洁的Python代码: 使用Exceptions(转)
add by zhj: 非常好的文章,异常在Python的核心代码中使用的非常广泛,超出一般人的想象,比如迭代器中,当我们用for遍历一个可迭代对象时, Python是如何判断遍历结束的呢?是使用的S ...
- python 简明教程 【转】
转自:https://learnxinyminutes.com/docs/python/ # Single line comments start with a number symbol. &quo ...
- 快速入门:十分钟学会PythonTutorial - Learn Python in 10 minutes
This tutorial is available as a short ebook. The e-book features extra content from follow-up posts ...
- Default Parameter Values in Python
Python’s handling of default parameter values is one of a few things that tends to trip up most new ...
- PYTHON学习之路_PYTHON基础(1)
学习内容: 1.Python介绍 2.Python程序初接触和变量 3.Python用户交互 4.Python数据类型 5.Python循环if...(elif)...else 6.Python循环w ...
随机推荐
- 【转载】【最短路Floyd+KM 最佳匹配】hdu 2448 Mining Station on the Sea
Mining Station on the Sea Problem Description The ocean is a treasure house of resources and the dev ...
- nacos搭建
1.下载执行包 直接官网 https://nacos.io/zh-cn/docs/quick-start.html 2. 建表 3. 启动 http://10.0.0.113:8848/nacos/i ...
- MySQL中的索引详讲(转)
https://www.cnblogs.com/whgk/p/6179612.html
- MySQL: Can’t connect to MySQL server on (111 “Connection refused”)
1. Mysql连接问题 远程访问mysql或者通过docker访问宿主机mysql经常会碰到下面的问题: Can't connect to MySQL server on (111 "Co ...
- Java知识导航总图
1.系统构架 企业服务总线(ESB).微服务.面向服务的架构(SOA) 了解分布式文件存储系统,掌握集群化开发及部署 2.系统系统集成技术 Wsbservice.Socket 3.RPC远程调用的相关 ...
- vue组件间的传值方式及方法调用汇总
1.传值 a.父组件传子组件 方法一: 父页面: <myReportContent v-if="contentState==1" :paramsProps='paramsPr ...
- c# 动态获取http通过post传来的json数据
//获取http通过post传来的json数据 using Newtonsoft.Json; public HttpResponseMessage Query() { var request=Syst ...
- Image Processing and Analysis_8_Edge Detection:Statistical edge detection_ learning and evaluating edge cues——2003
此主要讨论图像处理与分析.虽然计算机视觉部分的有些内容比如特 征提取等也可以归结到图像分析中来,但鉴于它们与计算机视觉的紧密联系,以 及它们的出处,没有把它们纳入到图像处理与分析中来.同样,这里面也有 ...
- python3使用ConfigParser从配置文件中获取列表
使用python3使用ConfigParser从配置文件中获取列表 testConfig.py #!/usr/bin/env python # coding=utf- __author__ = 'St ...
- nginx 缓存区太小导致后台Connection reset by peer 报错
问题概述:图片bit 64生成数据流太大,导致小程序分享弹窗的二维码图片生成失败 后台报错: 排查: Client------>nginx------->h5------>nginx ...