Show Menu
Cheatography

Python Cheat Sheet (DRAFT) by [deleted]

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Assignment Operators

a += 2
a = a + 2
7
a -= 2
a = a - 2
3
a *= 2
a = a * 2
10
a /= 2
a = a / 2
2.5
a //= 2
a = a // 2
2
a %= 2
a = a % 2
1
a **= 2
a = a ** 2
25
a = 5

Membership Operatoins

(b in list)
True
(c in list)
False
(b not in list)
False
(c not in list)
True
b = 12
c = 13
list = [1, 12, 45]
 

Angle Operation

degree­s(a­ngl­eRa­dian)
22.918­311­805­232932
radian­s(a­ngl­eDe­gree)
0.4000­000­000­000001
sin(an­gle­Radian)
0.3894­183­423­086506
cos(an­gle­Radian)
0.9210­609­940­028851
tan(an­gle­Radian)
0.4227­932­187­3816184
asin(no3)
0.5235­987­755­982989
acos(no3)
1.0471­975­511­965979
atan(no3)
0.4636­476­090­008061
angleR­adian = 0.4
angleD­egree = 22.918­311­805­232932
no3 = 0.5

Number Operation

abs(no2)
14.5
ceil(no1)
16
floor(no1)
15
exp(no1)
658299­2.5­845­83731
log(no1)
2.7536­607­123­542622
log10(no1)
1.1958­996­524­092338
max(no1, no2)
15.7
min(no1, no2)
-14.5
pow(no1, no2)
4.5651­498­746­472­13e-18
sqrt(no1)
3.9623­225­5123179

Random Number Generation

import random
random.seed(321)
random.uniform(10, 20)