def
keyword followed by a function name and
brackets (“()”):”) at the end of the brackets, and is
indented oncefunction_name() –> Hello 4061CEM
return statementmy_sum() –> 7
pass statementNotImplemented,)hello_person(“Ian”) –> Hello Ian and welcome to 4061CEM
hello_person(“Terry”) –> Hello Terry and welcome to 4061CEM
hello_person(“Daniel”) –> Hello Daniel and welcome to 4061CEM
Before Function Call: x = 10 [Address = 2313581363728]
Inside Function: x = 20 [Address = 2313581364048]
After Function Call: x = 10 [Address = 2313581363728]
Before Function Call: x = [4, 0, 6, 1] [Address = 2313582751296]
Inside Function: _list = [4, -9, 6, 1] [Address = 2313582751296]
After Function Call: x = [4, -9, 6, 1] [Address = 2313582751296]
hello_person(“Ian”, “4061CEM”) –> Hello Ian and welcome to 4061CEM!
hello_person(“Terry”, “4059CEM”) –> Hello Terry and welcome to 4059CEM!
hello_person() –> Hello Ian and welcome to 4061CEM!
hello_person(name=“Terry”, code=“4059CEM”) –> Hello Terry and welcome to 4059CEM!
hello_person(“Daniel”) –> Hello Daniel and welcome to 4061CEM!
parameter = valuehello_person(name=“Ian”, code=“4061CEM”) –> Hello Ian and welcome to 4061CEM!
hello_person(code=“4059CEM”, name=“Terry”) –> Hello Terry and welcome to 4059CEM!
*)
before the parameter nametuple of
arguments and access the items accordingly
hello_person(“Ian”, “4061CEM”) –> Hello Ian and welcome to 4061CEM!
hello_person(“Terry”, “4059CEM”) –> Hello Terry and welcome to 4059CEM!
**) before the parameter namedictionary of
arguments and access the items accordinglydef hello_person(**details):
print("Hello " + details['name'] + " and welcome to " + details['code'] + "!")hello_person(name=“Ian”, code=“4061CEM”) –> Hello Ian and welcome to 4061CEM!
hello_person(code=“4059CEM”, name=“Terry”) –> Hello Terry and welcome to 4059CEM!
hello_person(name=“Ian”, code=“4061CEM”) –> Hello Ian and welcome to 4061CEM!
hello_person(code=“4059CEM”, name=“Terry”) –> Hello Terry and welcome to 4059CEM!
__annotations__ attribute of a function:) after the name of the parameter-> followed by the data type
def
statement{‘x’: <class ‘int’>, ‘return’: <class ‘int’>}