(中职)函数课配套教程课件完整版电子教案.pptx

(中职)函数课配套教程课件完整版电子教案.pptx

  1. 1、本文档共388页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
课件PPT完整版课件全套课件整套课件全书课件全册课件完整版PPT全套PPT整套PPT全书PPT教学课件教学PPT课件汇总PPT汇总完整版电子教案全册电子教案全书电子教案教学教程幻灯片

全 册 课 件 延迟符 正版课件,所有文字、内容、动画均可修改。 注意:盗均不可修改 (中职)函数课配套教程课件完整版电子教案 1 动手学 Python,实践出真知! Python3 程序设计 函数 2 函数 Function 3 内置电池的 Python Python提供了非常完善的基础代码库,覆盖了网络、文件、GUI、数据库、文本等大量内容,被形象地称作“内置电池(batteries included)”。 用Python开发,许多功能不必从零编写,直接使用现成的即可。 4 Python3:68个内置函数 abs() dict() help() min() setattr() all() dir() hex() next() slice() any() divmod() id() object() sorted() ascii() enumerate() input() oct() staticmethod() bin() eval() int() open() str() bool() exec() isinstance() ord() sum() bytearray() filter() issubclass() pow() super() bytes() float() iter() print() tuple() callable() format() len() property() type() chr() frozenset() list() range() vars() classmethod() getattr() locals() repr() zip() compile() globals() map() reversed() __import__() complex() hasattr() max() round()   delattr() hash() memoryview() set()   5 函数的定义和使用 def hello( ) : print(Hello World!) print(hello()) # Hello World! def print_welcome(name): print(Welcome, name) print_welcome(Python) # Welcome Python # width = 4 height = 5 area = 20 def area(width, height): return width * height w, h = 4, 5 print(area(w, h)) # 20 无参函数 有参函数 有参函数 有返回值 最常用的函数:有输入有输出 6 函数的组成:函数名,参数,函数体 def area(length, width): return length * width 函数名 函数体 参数 7 关键字参数 L = [5, 2, 3, 1, 4] L1 = sorted(L) L2 = sorted(L, reverse=True) print(L1) # [1, 2, 3, 4, 5] print(L2) # [5, 4, 3, 2, 1] 关键字 sorted([4, 2, 6, 5]) sorted([4, 2, 6, 5], reverse=True) [2, 4, 5, 6] [6, 5, 4, 2] 默认值 可选参数 8 函数:不定长参数 9 不定长参数 采用元祖传递 采用字典传递 10 不定长参数 print(max(3, 4)) # 4 print(max(3, 4, 6, 1)) # 6 print(max(3, 4, 6, 1, 9)) # 9 打包为元祖 Python中内置函数max就是可以接收多个参数的函数 11 不定长参数:打包成元祖 def mysum(*args): # print(type(args)) # 验证args的类型 sum = 0 for x in args: sum += x return sum print(mysum(1, 2, 3)) # 6 打包为元祖,传递到 args 12 不定长参数:打包成字典 def fun(**kwargs): # print(type(kwargs)) for key in kwargs: print(%s = %s % (key, kwargs[key])) # Driver code fun(name

您可能关注的文档

文档评论(0)

你找对了 + 关注
实名认证
内容提供者

正版课件均可编辑 注意:其它人很多盗版P P T都是图片形式,买到请直接投诉退款!

1亿VIP精品文档

相关文档