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的更多相关文章

  1. Python tricks(4) -- with statement

    简介 with是从2.5版本引入的一个语法. 这个语法本身是为了解决try..finally繁琐的释放各类资源(文件句柄, Lock等)的问题. 如果想在旧版本中使用这个功能, 直接引入future模 ...

  2. Python基础(条件判断和循环) if elif else for while break continue;

    条件判断 计算机之所以能做很多自动化的任务,因为它可以自己做条件判断. 比如,输入用户年龄,根据年龄打印不同的内容,在Python程序中,用if语句实现: age = 20 if age >= ...

  3. python入门:if、elif、else 条件语句的基本用法

    #!/usr/bin/env python # -*- coding:utf-8 -*- #elif(否则如果,译音:埃尔夫)eise(否则,译音:埃尔斯) #if.elif.else 条件语句的基本 ...

  4. [Python] Symbol Review

    From:http://learnpythonthehardway.org/book/ex37.html 1. with X as Y: pass 1.1 yield 2. exec 2.1 name ...

  5. 写出简洁的Python代码: 使用Exceptions(转)

    add by zhj: 非常好的文章,异常在Python的核心代码中使用的非常广泛,超出一般人的想象,比如迭代器中,当我们用for遍历一个可迭代对象时, Python是如何判断遍历结束的呢?是使用的S ...

  6. python 简明教程 【转】

    转自:https://learnxinyminutes.com/docs/python/ # Single line comments start with a number symbol. &quo ...

  7. 快速入门:十分钟学会PythonTutorial - Learn Python in 10 minutes

    This tutorial is available as a short ebook. The e-book features extra content from follow-up posts ...

  8. 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 ...

  9. PYTHON学习之路_PYTHON基础(1)

    学习内容: 1.Python介绍 2.Python程序初接触和变量 3.Python用户交互 4.Python数据类型 5.Python循环if...(elif)...else 6.Python循环w ...

随机推荐

  1. windons下一些软件的地址

    idea http://download.jetbrains.8686c.com/idea/ideaIC-2018.3.1.exe

  2. 使用Duilib开发Windows软件(3)——控件的样式

    摘抄下 https://www.cnblogs.com/Alberl/p/3344936.html 的一段代码 <?xml version="1.0" encoding=&q ...

  3. Git拉取代码切换分支

    1.克隆代码 cd d:/GitTest //指定存放的目录 git clone https://git.oschina.net/name/test.git //你的仓库地址 2.查看远程所有分支 g ...

  4. 线段树 面积并问题 hdu 1255 1542

    重点整理面积并的思想 以及PushUp的及时更新 还有就是cover的实现 以及建树每个节点存的信息(每个节点存的是一个线段的信息) http://www.tuicool.com/articles/6 ...

  5. 一个因MySQL大小写敏感导致的问题

    做一个积极的人 编码.改bug.提升自己 我有一个乐园,面向编程,春暖花开! 00 MYSQL对大小写敏感 见字如面,见标题知内容.你有遇到过因为MYSQL对大小写敏感而被坑的体验吗? 之前看过阿里巴 ...

  6. iis 虚拟目录 文件服务器

    需求 多节点站点部署时,上传文件地址统一 调整步骤如下 建立文件服务器 共享目录 设置账号密码 各服务器建账号 密码 需与文件服务器账号密码一致 调整 web.config 在<system.w ...

  7. Element-ui-Basic

    一.Layout 布局 1.基础布局 <el-row> <el-col :span="24"><div class="grid-conten ...

  8. Eclipse中如何创建一个完整的Maven-Web项目

    Maven Web项目搭建 1.首先确保本地开发环境搭建完毕(jdk,maven). 2.打开Eclipse,新建Maven项目.选择Maven Project选项. 3.将第一项:Create a ...

  9. HugePages概述--翻译自19C文档

    翻译自: https://docs.oracle.com/en/database/oracle/oracle-database/19/unxar/administering-oracle-databa ...

  10. FreeRTOS列表和列表项

    FreeRTOS中的列表和列表项类似于数据结构中的链表和节点: 相关的文件是list.c和list.h两个文件: List_t列表结构体 具体定义如下: /* * Definition of the ...