1
2
3
♀ ♀ ♀♂♀♂♂♀♂♂♀
4
5
‘a’ + ‘hoy’
‘ahoy’
6
2 44 -3
3.14 4.5 -2.0
True False
‘¡hola!’ ‘its python time!’
7
18 + 69
6/23
2 * 100
2 ** 100
8
pow(2, 100)
max(50, 300)
min(-1, -300)
9
2 ** 100
pow(2, 100)
10
2 ** 100
pow(2, 100)
from operator import add 18 + 69
add(18, 69)
pow()
operator
add() div()
10
add ( 18 , 69 )
11
add ( 18 , 69 )
11
add ( 18 , 69 )
11
add ( 18 , 69 )
11
add ( 18 , 69 )
11
add(add(6, mul(4, 6)), mul(3, 5))
12
add(add(6, mul(4, 6)), mul(3, 5))
add
12
add(add(6, mul(4, 6)), mul(3, 5))
add add(6, mul(4, 6))
12
add(add(6, mul(4, 6)), mul(3, 5))
add add(6, mul(4, 6))
add
12
add(add(6, mul(4, 6)), mul(3, 5))
add add(6, mul(4, 6))
add 6
12
add(add(6, mul(4, 6)), mul(3, 5))
add add(6, mul(4, 6))
add 6 mul(4, 6)
12
add(add(6, mul(4, 6)), mul(3, 5))
add add(6, mul(4, 6))
add 6 mul(4, 6) mul
12
add(add(6, mul(4, 6)), mul(3, 5))
add add(6, mul(4, 6))
add 6 mul(4, 6) mul 4
12
add(add(6, mul(4, 6)), mul(3, 5))
add add(6, mul(4, 6))
add 6 mul(4, 6) mul 4 6
12
add(add(6, mul(4, 6)), mul(3, 5))
add add(6, mul(4, 6))
add 6 mul(4, 6) mul 4 6
12
add(add(6, mul(4, 6)), mul(3, 5))
add add(6, mul(4, 6))
add 6 mul(4, 6) mul 4 6
12
add(add(6, mul(4, 6)), mul(3, 5))
add add(6, mul(4, 6)) mul(3, 5)
add 6 mul(4, 6) mul 4 6
12
add(add(6, mul(4, 6)), mul(3, 5))
add add(6, mul(4, 6)) mul(3, 5)
add 6 mul(4, 6) mul mul 4 6
12
add(add(6, mul(4, 6)), mul(3, 5))
add add(6, mul(4, 6)) mul(3, 5)
add 6 mul(4, 6) mul 3 mul 4 6
12
add(add(6, mul(4, 6)), mul(3, 5))
add add(6, mul(4, 6)) mul(3, 5)
add 6 mul(4, 6) mul 3 5 mul 4 6
12
add(add(6, mul(4, 6)), mul(3, 5))
add add(6, mul(4, 6)) mul(3, 5)
add 6 mul(4, 6) mul 3 5 mul 4 6
12
add(add(6, mul(4, 6)), mul(3, 5))
add add(6, mul(4, 6)) mul(3, 5)
add 6 mul(4, 6) mul 3 5 mul 4 6
12
add(add(6, mul(4, 6)), mul(3, 5))
add add(6, mul(4, 6)) mul(3, 5)
add 6 mul(4, 6) mul 3 5 mul 4 6
12
13
14
x=7
15
x=7
x = 1 + 2 * 3 – 4 // 5
15
x = 10 y=3
result1 = x * y
result2 = x + y
16
x = 10 y=3
result1 = x * y
result2 = x + y
16
my_name = ‘Pamela’
my_name = my_name + ‘ela’
my_name
17
my_name = ‘Pamela’
my_name = my_name + ‘ela’
my_name
my_name
17
f = min
f = max
g = min
h = max
max = g
max(f(2, g(h(1, 5), 3)), 4)
18
19
20
=
=
21
22
♻
add(18, 69)
mul(60, sub(5, 4))
23
♻
add(18, 69)
mul(60, sub(5, 4))
18,69→ add →87
23
def
def
def add(num1, num2): return num1 + num2
add(2, 2)
add(18, 69)
24
def
def add(num1, num2): return num1 + num2
# ← Function signature
# ← Function body
# ← Function signature
# ← Function body
25
def
def add(num1, num2): return num1 + num2
def add(num1, num2): sum = num1 + num2 return sum
# ← Function signature
# ← Function body
# ← Function signature
# ← Function body
# ← Function signature
# ← Function body
# ← Function body
25
def add(num1, num2): return num1 + num2
x=1 y=2 add(x, y)
x=3
add(x * x, x + x)
26
def add(num1, num2): return num1 + num2
sum = add(2, 4)
big_sum = add(200, 412) + add(312, 256)
huge_sum = add(add(200, 412), add(312, 256))
27
def add(num1, num2): return sum
sum = num1 + num2
sum = add(2, 4)
28
def add(num1, num2): return sum
sum = num1 + num2
sum = add(2, 4)
28
def add():
return num1 + num2
sum = add(2, 4)
29
def add():
return num1 + num2
sum = add(2, 4)
29
def add(num1, num2): sum = num1 + num2
sum = add(2, 4)
30
def add(num1, num2): sum = num1 + num2
sum = add(2, 4)
30
name parameters
31
32
33
34
35
def exclamify(text):
start_exclaim = “¡”
end_exclaim = “!”
return start_exclaim + text + end_exclaim
exclamify(“the snails are eating my lupines”) start_exclaim
text
exclamify
36
def exclamify(text):
start_exclaim = “¡”
end_exclaim = “!”
return start_exclaim + text + end_exclaim
exclamify(“the snails are eating my lupines”) start_exclaim
text
exclamify
36
def exclamify(text):
start_exclaim = “¡”
end_exclaim = “!”
return start_exclaim + text + end_exclaim
exclamify(“the snails are eating my lupines”) start_exclaim
text
exclamify
36
def exclamify(text):
start_exclaim = “¡”
end_exclaim = “!”
return start_exclaim + text + end_exclaim
exclamify(“the snails are eating my lupines”) start_exclaim
text
exclamify
36
start_exclaim = “¡” end_exclaim = “❣️”
def exclamify(text):
return start_exclaim + text + end_exclaim
exclamify(“the voles are digging such holes”) start_exclaim
text
exclamify
37
start_exclaim = “¡” end_exclaim = “❣️”
def exclamify(text):
return start_exclaim + text + end_exclaim
exclamify(“the voles are digging such holes”) start_exclaim
text
exclamify
37
start_exclaim = “¡” end_exclaim = “❣️”
def exclamify(text):
return start_exclaim + text + end_exclaim
exclamify(“the voles are digging such holes”) start_exclaim
text
exclamify
37
start_exclaim = “¡” end_exclaim = “❣️”
def exclamify(text):
return start_exclaim + text + end_exclaim
exclamify(“the voles are digging such holes”) start_exclaim
text
exclamify
37
def exclamify(text):
end_exclaim = “!?️️️”
return start_exclaim + text + end_exclaim
exclamify(“the voles are digging such holes”) NameError
38
def exclamify(text):
end_exclaim = “!?️️️”
return start_exclaim + text + end_exclaim
exclamify(“the voles are digging such holes”) NameError
start_exclaim
38
def exclamify(text):
end_exclaim = “!?️️️”
return start_exclaim + text + end_exclaim
exclamify(“the voles are digging such holes”) NameError
start_exclaim
exclamify
38
39
40