python学习,day3:函数式编程,带return

return的主要作用就是,在调用的时候,能知道函数的运行情况,相当于打个标签

# coding=utf-8
# Author: RyAn Bi
def test1():
    print('in the test1')

def test2():
    print('in the test2')
    return 0
def test3():
    print('in the test3')
    return 'a',[1,2],(1,3,4,7),{'bb':'1'}  #只是返回相应内存中的值,所以可以多个元素,但是输出当做一个元组

x = test1()
y = test2()
z = test3()

print(x)
print(y)
print(z)

  

猜你喜欢

转载自www.cnblogs.com/bbgoal/p/10373299.html