-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpython101.txt
More file actions
116 lines (88 loc) · 2.06 KB
/
python101.txt
File metadata and controls
116 lines (88 loc) · 2.06 KB
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
Python has become THE language of Data Science.
Everybody uses Anaconda python distribution.
The main dev. environment is JupyterLab:
https://jupyterlab.readthedocs.io/en/stable/
Also you need a simple text editor, for example:
https://www.sublimetext.com/
Look on youtube for online tutorials for:
python, pandas, numpy, scikit-learn
for example:
Python Programming - tutorial by Derek Banas:
- https://www.youtube.com/watch?v=N4mEzFDjqtA
Python Pandas Data Science Tutorial by Keith Galli:
- https://www.youtube.com/watch?v=vmEHCJofslg
Python NumPy Tutorial by Edureka:
- https://www.youtube.com/watch?v=8JfDAm9y_7s
Scikit-Learn Tutorial by Simplilearn:
- https://www.youtube.com/watch?v=0Lt9w-BxKFQ
Python main data structures:
a = 1
b = 2.5
c = "crocodile"
d = 'big mouse'
e = """multi-line
string"""
# ---------------------
f = list()
f = [1,"mama", 2.5]
# ---------------------
g = (1,2,3) # tuple immutable
h = tuple([1,2,3]) # same tuple
# ---------------------
h = set([1,1,2,2,3,3]) # {1,2,3} set removes duplicates
h = {1,2,3} # same set
# ---------------------
i = dict()
i = {"k1":"v1", "k2":"v2"}
i["k3"] = "v3"
if "k3" in i:
...
aa = i["k1"] # "v1"
del i["k1"]
# ---------------------
Python common keywords and expressions:
True, False, None
if, elif, else, finally
if (a == b or c != d) and (e==f):
pass
for ii in range(5):
print(ii)
def myfunction():
pass # placeholder
return something
import os, sys
from mymodule import myfunc
while ... :
pass
if ...:
continue
if ...:
break
pass
try:
pass # do something
except:
pass # processs error
raise some_error
if "a" in mystring:
do_something
if "a" not in mystring:
do_something
ii = 0
while ii < 10:
ii += 1
print(ii)
with open("myfile.txt") as fh:
txt = fh.read()
Some other keywords:
await
class
is
lambda
nonlocal
assert
global
async
yield
See for example here:
https://realpython.com/python-keywords/