Python3-def

简介: def hello(): print("这是一个无参数的方法!")hello();print("")def helloOne(str): print(str);helloOne("一个带参数的字符串!")print("")#带有默认值的...
def hello():
    print("这是一个无参数的方法!")

hello();


print("")

def  helloOne(str):
    print(str);

helloOne("一个带参数的字符串!")

print("")

#带有默认值的参数
#若直接调用helloTwo()不传参数 ,使用该方法参数默认值 ,否则使用传入参数
def helloTwo(age = 35):
    print(age)

helloTwo(50);

def area(width=50,height=60):
    return width * height

print(area(200,200))

目录
相关文章
|
数据挖掘 数据处理 Python
Python中的def函数
Python中的def函数
|
数据挖掘 Linux Python
Python学习笔记丨函数和类相关基础知识总结和易错点分享,包括def、lambda、class等
Python学习笔记丨函数和类相关基础知识总结和易错点分享,包括def、lambda、class等
|
Python
python自定义函数 def 的奇妙世界
这里是三岁,来和大家唠唠自定义函数,这一个神奇的东西,带大家白话玩转自定义函数
493 0
python自定义函数 def 的奇妙世界
|
Python
Python关于def函数的说明
Python关于def函数的说明
508 0
|
C++ Python
python类中初始化形式:def __init__(self)和def __init__(self, 参数1,参数2,,,参数n)区别
python类中初始化形式:def __init__(self)和def __init__(self, 参数1,参数2,,,参数n)区别
670 0
|
Python
【Python从入门到实践3.1】扑克发牌知识点(range函数,def函数,else语句配合使用,random库,列表推导式)
【Python从入门到实践3.1】扑克发牌知识点(range函数,def函数,else语句配合使用,random库,列表推导式)
|
Python
Python def定义函数并进行序列解包源码操作解析
Python def定义函数并进行序列解包源码操作解析
322 0
|
Python C语言
Python牛刀小试(二)--代码解析(DEF&文件操作)
点击(此处)折叠或打开 # -*-coding=utf-8-*- __author__ = 'zhangshengdong' ''' 个人技术博客:http://blog.
1520 0
|
Python
PYTHON之DEF
def sayHello(): print('Hello World!') while True: s = input('Enter something : ') if s == 'quit': break if len(s) < ...
1138 0

推荐镜像

更多