Show Menu
Cheatography

Beginner Python Cheat Sheet (DRAFT) by

Basic Python Operations

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

Data Types

Integer
-567, 175
Float
-46.21, 7.9e-10
String
"­Hel­lo", 'Bye', '''Smi­le'''
Boolean
True, False
List
[value, value, ...] or []
Tuple
(value, value, ...) or ()
Dictionary
{key : value, ...} or {}
Set
{value, value, ...} or set()

Arithmetic Operators

x + y
add
x % y
modulus
x - y
substract
x // y
remainder
x * y
multiply
x ** y
square
x / y
divide
x op= y
eg: x+=1

Arithmetic Compar­isons

x < y
Less
x <= y
Less or Eq
x > y
Greater
x >= y
Greater or Eq
x == y
Equal
x != y
Not Equal

Boolean Logic Operators

x and y
x or y
not x