-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconversion.py
82 lines (53 loc) · 960 Bytes
/
conversion.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
1 + 1
print(5)
a = 5
dictionary = {
'hello': 'hi',
'there': 'that'
}
word = dictionary['hello']
b = 'hello'
b[0] = 'j'
array = ['s', 5, 8]
third = array[2]
var zero_to_three = array.slice(0, 3)
last_element = array[len(array) - 1]
new_array = []
new_array.append(1)
new_array.append(2)
new_array.pop()
new_array.insert(0, 'a')
new_array.pop(0)
#############################################
def square(num):
return num * num
c = square(a)
if True:
return True
elif False:
return None
elif False or True:
return True and False
elif 0 == 1:
return 0
else:
return 'error'
while a > 0:
a -= 1
for x in range(5):
print(x ** 2)
#############################################
sheep = lambda x: x
def higher_order(num):
def inception():
nonlocal num
num += 5
inception()
return num
higher_order(6) # returns 11
mess_this = 1
def will_do():
global mess_this
mess_this += 6
will_do()
print(mess_this) # 7