Functions
Functions
The following are the types of arguments that we can use to call a function:
Default arguments
Keyword arguments
Required arguments
Variable-length arguments
--------
Default Arguments
Output
Passing only one argument
number 1 is: 30
number 2 is: 20
Passing two arguments
number 1 is: 50
number 2 is: 30
------
Output
Without using keyword
number 1 is: 50
number 2 is: 30
With using keyword
number 1 is: 30
number 2 is: 50
-----
def square( item_list ):
squares = [ ]
for l in item_list:
squares.append( l**2 )
return squares