zoukankan      html  css  js  c++  java
  • Python 中的函数

    函数的定义

    lanmda函数

    函数的引用(有参数和无参数)

    参数的默认值

    关键字参数,及顺序(非关键字参数要在关键字参数之前使用)

    递归 1. 反复调用自己

            2. 必须有边界条件,即停止递归的条件

            回归 + 递推

    递归与循环的比较

            递归的代码更简洁、更符合自然逻辑、更容易理解

    递归的效率: 资源消耗比循环大

     def foo(arg1, *args):
         print("Type arg1 is {}, value: {}".format(type(arg1), arg1))
         print("Type of args is {}, value: {}".format(type(args), args))
    

    foo("arg1", "arg2", "arg3")
    Type arg1 is <type 'str'>, value: arg1
    Type of args is <type 'tuple'>, value: ('arg2', 'arg3')

        

  • 相关阅读:
    渐变
    阴影
    html+css
    background用法
    语言特点
    h5c3介绍
    js的组成
    第九章 查找文件或者命令
    第八章 查看文件内容命令
    第七章 文件管理之基础命令
  • 原文地址:https://www.cnblogs.com/hanxiangmin/p/11279947.html
Copyright © 2011-2022 走看看