Show Menu
Cheatography

Python cheat sheet Cheat Sheet (DRAFT) by

Python cheat sheet for aqa alevel compter science

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

Data Types

Integer
int(x)
Real/Float
float(x)
Boolean
bool(x)
Character
chr(x)
String
str(x)
Date/Time
dateti­me.d­at­eti­me.s­tr­pti­me(x, '%Y-%m-%d %H:%M:­%S.%f')
Array
array(x)
Records in python are only used in the context of pandas
 

Progra­mming Concepts

Variable delaration
x = var
Iteration
for i in x:
 
for i in range(x):
Selection
if condition:
Subroutine
def subrou­tin­e(x):
 
return(x)
while condition == True:
 

Arithmetic operations in a progra­mming language

Addition