Python Cheat Sheet 2
Python Cheat Sheet 2
Lists Store multiple items in a single variable Scope Where in the program a variable is visible
snow = [0.3, 0.0, 0.0, 1.2, 3.9, 2.2, 0.8] t = 29 # Global scope
# Slicing
snow_weekday = snow[0:5] Classes & Objects A class is a template for the objects
snow_weekend = snow[5:7]
class Person:
def __init__(self, name, age):
self.name = name
List Functions & Methods Update lists or analyze list items self.age = age
x = [1, 2, 3]
y = [4, 6, 8]
Functions Define once to use multiple times
Notes
Made with by