Skip to content

Commit 7460aed

Browse files
committed
init
0 parents  commit 7460aed

File tree

2 files changed

+137
-0
lines changed

2 files changed

+137
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- [Lecture 1](/lecture1.md)

lecture1.md

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
2+
Installation
3+
------------
4+
5+
- download from https://www.python.org/
6+
- instructions https://realpython.com/installing-python/
7+
- linux:
8+
```bash
9+
sudo apt-get update
10+
sudo apt-get install python3.8 python3-pip
11+
sudo apt-get install python3-virtualenv
12+
```
13+
- for now, use repl.it
14+
15+
Python
16+
---------
17+
18+
- Programming language
19+
- General purpose
20+
- Very high level
21+
- Simple, easy to learn, but powerful
22+
- Dynamically typed, but strongly typed (has static type checkers)
23+
- Multi paradigm - supports OOP, functional, procedural, Async
24+
- Excellent tooling - Pycharm, extensions for all major editors, flake8, pylint, black, mypy
25+
- Mature and extensive ecosystem
26+
- Seen mostly in
27+
- Web Development - django, flask
28+
- Data Analytics and Machine Learning - numpy, scipy, matplotlib, sklearn, ternsorflow, torch, pandas
29+
- DevOps & Scripting
30+
- Distributed Computing - pyspark, dask
31+
- Awesome-Python: [https://github.com/vinta/awesome-python](https://github.com/vinta/awesome-python)
32+
33+
# Basics
34+
```py
35+
2 + 2 * 2 - 2 / 2 // 2 ** 2
36+
10 / 3
37+
10 // 3
38+
5 ** 5
39+
(-1) ** (1/2)
40+
```
41+
42+
```py
43+
width = 20
44+
height = 50
45+
area = width * height
46+
_
47+
x
48+
```
49+
50+
```py
51+
'hello, world'
52+
# escaping special chars, triple quoted, double quoted, f-strings, byte-strings
53+
# comments
54+
```
55+
56+
```py
57+
print('Hello, World!')
58+
x = int(input('Enter number'))
59+
```
60+
61+
62+
```py
63+
x = int(input('Enter number'))
64+
y = int(input('Enter number'))
65+
operator = input('Enter operator')
66+
operator = operator.strip().lower()
67+
if operator == 'add':
68+
print(f'{x} + {y} = {x+y}')
69+
elif operator == 'power':
70+
print(f'{x} ^ {y} = {x ** y}')
71+
else:
72+
print('I don\'t know what to do')
73+
```
74+
75+
```py
76+
classes = ['ds-algo', 'python', 'machine-learning', 'ama']
77+
for c in classes:
78+
print(c, len(c), c.upper(), c.lower())
79+
80+
# can't use class as a variable name, because it is a keyword
81+
import keyword
82+
keyword.kwlist
83+
```
84+
85+
```py
86+
for i in range(10):
87+
print(f'Square of {i} is {i**2}')
88+
```
89+
90+
```py
91+
range(10)
92+
range(1, 10)
93+
range(1, 10, -1)
94+
```
95+
96+
```py
97+
classes = ['ds-algo', 'python', 'machine-learning', 'ama']
98+
for index, c in enumerate(classes):
99+
print(index, c, len(c), c.upper(), c.lower())
100+
```
101+
102+
```py
103+
sum(range(1000))
104+
list(range(1000))
105+
```
106+
107+
```py
108+
while True:
109+
pass
110+
111+
i = 0
112+
while i < 10:
113+
print(i)
114+
i += 1
115+
```
116+
117+
```py
118+
def foo():
119+
pass
120+
121+
def fib(n):
122+
if n <= 1: return n
123+
return fib(n-1) + fib(n-2)
124+
125+
from functools import lru_cache
126+
127+
help()
128+
dir()
129+
a, b = b, a
130+
snake_case
131+
collections.Counter
132+
import math
133+
math.pi
134+
math.e
135+
```
136+

0 commit comments

Comments
 (0)