-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpython.txt
283 lines (215 loc) · 3.8 KB
/
python.txt
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
Charles Thomas Wallace Truscott Watters
declarative vs imperative knowledge
+ - * / // % ** ( ) != == += -= *= /= //= %= **= & | ^ ~ << >> &= |= ^= ~= <<= >>= . * ** [ ] [i:j] [i:j:k] [i][j] [i][j][k] ; : , __ =
int, float, string, set, tuple, list, dictionary, class, object, function, function invocation, function return, combined type, expression
operator, operand
True, False, lambda, yield, from x import y as z
assert, global, nonlocal, pass, del
break, continue, is, is not, in, is in
try:
except:
finally:
else:
raise:
def function(args):
body
return
def main():
body
if __name__ == "__main__": function()
abstraction, decomposition
for x in range(start, stop, step):
for x in a:
for y in b:
for x in a:
for y in x:
while(bool):
while(bool):
def recursive_function(parameter_one, parameter_two):
base case x:
base case y:
base case z:
body
recursive_function(parameter_one - 1, parameter_two - 1)
return
iteration, recursion
if (bool):
if (bool):
if (bool):
elif (bool):
elif (bool):
else:
elif(bool):
elif(bool):
else:
elif(bool):
elif(bool):
else:
match(object):
case x:
body
case y:
body
case z:
body
branching, conditionals, control flow
class Fraction(object):
def __init__(self, numerator, denominator):
self.numerator = numerator
self.denominator = denominator
def add(self):
pass
def subtract(self):
pass
def multiply(self):
pass
def divide(self):
pass
"""
Created on Sun Jan 1 03:27:11 2023
@author: Charles
"""
class Person(object):
def __init__(self, name, date_of_birth, location):
self.name = name
self.date_of_birth = date_of_birth
self.location = location
def print_name(self):
print("{}".format(self.name))
class Student(Person):
def __init__(self, name, grades):
super().__init__(name, None, "Byron Bay")
self.grades = grades
def print_grades(self):
print("Grades: {}".format(self.grades))
class Employee(Person):
def __init__(self, name, salary):
super().__init__(name, None, "Byron Bay")
self.salary = salary
def print_name(L):
for n in L:
n.print_name()
def print_all():
John = Student("John Wayne", {"6.0001": "B", "PH526": "A"})
Charles = Employee("Charles Truscott", 50000)
print_name([John, Charles])
if __name__ == "__main__": print_all()
Encapsulation, Inheritance, Polymorphism, Generators, Decorators
Standard Library
string
textwrap
re
difflib
enum
collections
array
heapq
bisect
queue
struct
weakref
copy
pprintf
functools
itertools
operator
contextlib
time
datetime
calendar
decimal
fractions
random
math
statistics
numpy
pandas
matplotlib
os.path
pathlib
glob
fnmatch
linecache
tempfile
shutil
filecmp
mmap
codecs
io
pickle
shelve
dbm
sqlite3
xml.etree.ElementTree
csv
zlib
gzip
bz2
tarfile
zipfile
hmac
hashlib
subprocess
signal
threading
multiprocessing
asyncio
concurrent.futures
gettext
locale
ipaddress
socket
selectors
select
socketserver
urllib.parse
urllib.request
urllib.robotparser
base64
http.server
http.cookies
uuid
json
xmlrpc.client
xmlrpc.server
webbrowser
argparse
getopt
readline
getpass
cmd
shlex
configparser
logging
fileinput
atexit
sched
pydoc
doctest
unittest
trace
traceback
cgitb
pdb
profile
pstats
timeit
tabnanny
compileall
pyclbr
venv
ensurepip
site
sys
os
platform
resource
gc
sysconfig
scipy
sklearn
tensorflow
Algorithmic Complexity
Object Orientation -> data and method attributes, setters and getters, decorators, magic methods, inheritance, polymorphism, encapsulation
Requirements Analysis
Algorithms and Data Structures / Sorting and Searching / Algorithm Design / Data Structure Design