-
Notifications
You must be signed in to change notification settings - Fork 0
/
04 - Functions.py
18 lines (14 loc) · 957 Bytes
/
04 - Functions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#############################################################################################################
# 1. Functions
#############################################################################################################
# In order to use a procedure, you need the name of the procedure using def, followed by a left parenthesis, a list of the procedure's inputs (sometimes called operands or arguments)
def abbaize(a,b): # defines a function 'abbaize' with two inputs
c = a+b*2+a # concatenates the two inputs
return c # return prints the output
# remember with functions, return outputs to a new line - especially important if you need one function's output to feed into another function
def distance_from_zero(n):
if type(n) == int or type(n) == float:
print "Print does not output the function"
return abs(n)
else:
return "Nope"