Python Basics Cheat Sheet

A quick reference for basic Python syntax and data structures.

TypeExample
Integerx = 10
Floatx = 10.5
Stringx = "Hello"
Booleanx = True

StructureExample
Listmy_list = [1, 2, 3]
Tuplemy_tuple = (1, 2, 3)
Dictionarymy_dict = {"key": "value"}
Setmy_set = {1, 2, 3}

StatementExample
If-Elseif x > 10: ... else: ...
For Loopfor item in my_list: ...
While Loopwhile x < 10: ...