Chapter3.1.2 函数的调用
来源:互联网 发布:rhino软件适合做游戏 编辑:程序博客网 时间:2024/06/14 04:50
#!/usr/bin/env python# -*- coding:utf-8 -*-#Author:xp#blog_url: http://blog.csdn.net/wuxingpu5/article/details/71209731#调用函数分无参函数 有参函数#无参函数 调用时无参#有参函数 调用时有参# def foo():# print('from foo')# def bar(name):# print('bar==>',name)# foo()# bar('egon') #直接调用## def my_max(x,y):# res = x if x > y else y# return res## res = my_max(1,2)*1000000 #调用函数的表达式# print(res)## res = my_max(my_max(10,20),30) #把函数当做另一个函数的参数# print(res)#==============================================返回值====================================================='''以下返回None不写returnreturn None'''def foo(): print('from foo') x = 1 return 1,[2,3],(4,5),{}# res = foo()# print(res)# #可以返回任意类型 返回结果在一个元组中:((1, [2, 3], (4, 5), {}))## #取出元组值到每个变量# t=(1,2,3)# a,b,c = t## a,b,c,d = foo() #返回值存到哥哥变量t=(1,2,3,) #下划线占位符a,_,_=tprint(a)t=(1,2,3,4,5,6,7,8)a,*_,c=t #*_替代中间所有值print(a,c)
阅读全文
0 0
- Chapter3.1.2 函数的调用
- Chapter3.1.4python函数的参数
- LDD chapter3:write的奥秘-linux系统调用如何实现?
- 【Chapter3】LWP的do_GET
- Chapter3.1 Python函数(1)
- chapter3
- chapter3
- chapter3 常用的运算符
- 《算法导论》学习笔记之Chapter3函数的增长 Chapter4.1分治策略
- 《c++语言程序设计》部分代码chapter3函数
- [Python入门]Chapter3 函数
- Chapter3.1.1 python函数小示例
- Professional XNA Game Programming Chapter3 的例子
- logback和slf4j的使用chapter3
- Chapter3.3 HotShop算法的实现
- 直接调用函数的函数
- 汇编函数的调用
- 函数的递归调用
- strcat源代码汇总
- jfinal数据库连接txt文档
- dfs序详解
- c++实验6-矩阵求和
- 两种复合数列排序方式
- Chapter3.1.2 函数的调用
- mac 下移植 x264 使用 neon 多线程加速
- 【笔记】shiro中的验证码设置:
- Chapter3.1.4python函数的参数
- 如何在frgament里边添加Tabhost
- 系统程序员成长计划
- mysql分数占百分比查询
- Inception V3 的 tensorflow 实现
- 项目经理那些事、一:客户需求是个坑