functions
P Y T H O N D ATA S C I E N C E T O O L B O X ( PA R
Hugo Bowne-Anderson
Instructor
,You’ll learn:
De ne functions without parameters
De ne functions with one parameter
De ne functions that return a value
Later: multiple arguments, multiple return values
,Built-in functions
str()
x = str(5)
print(x)
'5'
print(type(x))
<class 'str'>
, Defining a function
def square(): # <- Function header
new_value = 4 ** 2 # <- Function body
print(new_value)
square()
16