Functions perform some task - mini program
May take arguments/parameters
My return a value that can be used late
None is a "null" value.
If you don't return something, the function returns None
x = print("hello")
print(x)
def helloWorld():
print("Hello, world!")
return None
x = helloWorld()
print(x)
# Return and print are not the same:
def sum(x, y):
return print(x + y)
z = sum(5, 10)
print("The return value is:", z)
# Global variables are not function arguments
kilos = 11
def kilos_to_pounds(kilos):
return kilos * 2.205
kilos_to_pounds(10)