#if else示例
x = 5
y = 8

if x > y:
print("x is greater than y")
else:
print("x is not greater than y")

print("--------------")
#if-elif-else
x = 15
y = 18
z = 15

if x > y:
print("x is greater than y")
elif x < z:
print("x is less than z")
else:
print("上面两种条件都不执行,才执行此代码")
print("--------------")
#函数
def example():
print("basic function example")
z = 3 + 9
print(z)
example()
print("--------------")
#求两个数最大值
def twomax(a,b):
if a > b:
print("max is %s"%(a))
else:
print("max is %s"%(b))

twomax(3,8)
def threemax(x,y,z):
if x > y:
twomax(x,z)
else:
twomax(y,z)
threemax(12,18,45)

python3.5.3rc1学习二的更多相关文章

  1. python3.5.3rc1学习十一:字典与模块

    #os模块import oscurDir = os.getcwd()print(curDir) os.mkdir("新建") import timetime.sleep(2)os. ...

  2. python3.5.3rc1学习十:网络请求

    #sys模块import sys sys.stderr.write('This is stderr text\n')# 因为从定向有缓冲区,所以需要以下这行代码sys.stderr.flush()sy ...

  3. python3.5.3rc1学习九:正则表达式

    # 正则表达式 ''''' 正则表达式是有一些特殊字符组成,能够帮你找到一些符合一定规则的字符串 先来了解几个符号所代表的意思 \d 匹配所有的数字 \D 匹配所有,但是数字除外 \s 空格 \S 匹 ...

  4. python3.5.3rc1学习八:文件打包

    from cx_Freeze import setup, Executable setup(name='test to exe', version = '0.1', description='test ...

  5. python3.5.3rc1学习七:多线程

    import threading def exampleFun(): #打印当前激活的线程数量 print(threading.active_count) #查看上面激活的线程是哪几个 print(t ...

  6. python3.5.3rc1学习六:画图

    # 可以设置颜色,g代表green, r代表red,y代表yellow,b代表blue# linewidth = 5,设置线条粗细 # label 设置线条名称 ##plt.plot(x,y,'b', ...

  7. python3.5.3rc1学习五:模块

    #比较大小#name:maxNumber.py#比较两个数大小#C:\Users\Anthony\AppData\Local\Programs\Python\Python36-32\Lib\site- ...

  8. python3.5.3rc1学习五:列表与元组

    #元组和列表 #元组定义x = 5,6,2,6 #or x = (5,6,2,6) #列表定义 y = [5,6,2,6] # 元组的使用,我们用return语句来演示 def exampleFunc ...

  9. python3.5.3rc1学习四:类

    class calculator: def add(x,y): return x + y print(added) def sub(x,y): return x - y print(sub) def ...

随机推荐

  1. 3-3 用户管理-新建用户useradd和passwd

    3.用户管理 终端命令 提示:创建用户/删除用户/修改其他用户密码的终端命令都需要通过sudo执行 3.1创建用户/修改密码/删除用户 序号 命令 作用 说明 01 useradd -m -g 组 新 ...

  2. TensorFlow从1到2(十四)评估器的使用和泰坦尼克号乘客分析

    三种开发模式 使用TensorFlow 2.0完成机器学习一般有三种方式: 使用底层逻辑 这种方式使用Python函数自定义学习模型,把数学公式转化为可执行的程序逻辑.接着在训练循环中,通过tf.Gr ...

  3. java8-05-再探函数式接口

      1.自定义函数式接口  MyFun      传入一个参数    返回一个参数

  4. 201871010126 王亚涛《面向对象程序设计 JAVA》 第十三周学习总结

      内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 https://www.cnblogs.com/nwnu-daizh/p/ ...

  5. LeetCode 5273. 搜索推荐系统 Search Suggestions System

    地址 https://leetcode-cn.com/problems/search-suggestions-system/ 题目描述给你一个产品数组 products 和一个字符串 searchWo ...

  6. Codeforces Round #594 (Div. 1) D2. The World Is Just a Programming Task (Hard Version) 括号序列 思维

    D2. The World Is Just a Programming Task (Hard Version) This is a harder version of the problem. In ...

  7. Selenium+java - 通过Robot对象上传文件

    思路: 1.将文件路径复制到剪切板 2.用robot对象模拟键盘操作即可 复制文件代码: public void setClipboardData(String data) { StringSelec ...

  8. jieba 分词使用入门

    1. 介绍 JIEBA 是目前最好的 Python 中文分词组件,它主要有以下 3 种特性: 支持 3 种分词模式:精确模式.全模式.搜索引擎模式 支持繁体分词 支持自定义词典 import jieb ...

  9. Spring框架的相关介绍

    Spring是一个开源轻量级的框架,它的核心是控制反转(IOC)和面向切面编程(AOP). 作为业务层框架的spring能够很好地整合表现层跟持久层. IOC:将类的创建和依赖关系写到配置文件里,可以 ...

  10. C#上手练习1(if语句、Swich语句)

    1.打印字符串. 2.调用简单方法,方法里有if语句.Swich语句. C# if else 语句是最常用的条件语句,并且 if else 语句的形式有多种,包括单一条件的 if 语句.二选一条件的 ...