day8 the basis of a python function

Call the definition of the function is a function of two parts

Defined Functions when inside the code is not executed, until then call the function execution

 

 

Do not write and write-only return return return None

Function encounters return, this function is terminated

 

          

Ganso and the list can unpack

def func():
    lis=['火狐','谷歌']
    for i in lis:
        print(i)
    return 0
def func1():
    print(func()) #这里返回的是return 0 后面的0,不打印什么也没有
    lis=['火狐','谷歌']
    for i in lis:
        print(i)
    return 1
print(func1())
内容

 

Guess you like

Origin www.cnblogs.com/wang-tan/p/11016573.html