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. mysql中char和varchar区别

    char是一种固定长度的类型,varchar则是一种可变长度的类型  char(M)类型的数据列里,每个值都占用M个字节,如果某个长度小于M,MySQL就会在它的右边用空格字符补足.(在检索操作中那些 ...

  2. Redis的AOF重写脚本

    手动触发 每天定期的去执行一次 写了一个脚本 bgrewriteaof.sh 内容如下: #!/bin/bash /usr/local/redis/redis-cli -p 6379 -h 127.0 ...

  3. 【计算几何】The Queen’s Super-circular Patio

    The Queen’s Super-circular Patio 题目描述 The queen wishes to build a patio paved with of a circular cen ...

  4. SSH框架结合案例构建配置

    ssh框架概述 SSH是 struts+spring+hibernate的一个集成框架,是目前比较流行的一种Web应用程序开源框架.区别于 Secure Shell . 集成SSH框架的系统从职责上分 ...

  5. 附录:ARM 手册 词汇表

    来自:<DDI0406C_C_arm_architecture_reference_manual.pdf>p2723 能够查询到:“RAZ RAO WI 等的意思” RAZ:Read-As ...

  6. Zookeeper 安装及集群配置注意点

    Zookeeper在ubuntu下安装及集群搭建,关于集群搭建,网上很多文章 可以参考:https://www.ibm.com/developerworks/cn/opensource/os-cn-z ...

  7. 用mybatis将SQL查询语句”select * from user”的封装为配置文件

    用mybatis将SQL查询语句”select * from user”的封装为配置文件 定义一个xml映射文件,文件名见名知意.如user-mapper.xml,文件内容如下: <?xml v ...

  8. vagrant 搭建开发环境

    虚拟机盒子地址 https://app.vagrantup.com/boxes/search vagrant init hirocom/centos7.2vagrant up 修改配置 config. ...

  9. 参数化查询防止Sql注入

    拼接sql语句会造成sql注入,注入演示 namespace WindowsFormsApp1 { public partial class Form1 : Form { public Form1() ...

  10. Ubuntu 文件和目录常用命令

    目标 查看目录内容 ls 切换目录 cd 创建和删除操作 touch rm mkdir 拷贝和移动文件 cp mv 查看文件内容 cat more grep 其他 echo 重定向 > 和 &g ...