Table of Contents

Variable Declaration

variable_name = "test"
variable2 = 24
variable3 = str(34)
variabl4 = int("6")

Loops and Decision Making

if/elif/else

if <condition>:
	# Do something
elif <condition>:
	# do something if that happens
else:
	# do something if anything else

while

while <condition>:
	# do something
	# condition breaker!!!

for

for i in <iterator>:
	# do something with i

Classes

Class declaration

class Class_Name(inherited_class):
	def __init__(self):
		# Constructor
		self.property = 0
		self.property = "hede"

	def method_name(self, param1, param2):
		# self is omitted when used. e.g. Class_Name().method_name(1,2)

Delegating stuff to base class

class Person():
	def __init__(self):
		self.name = "test"
		print("Hi I am a person!")
	# other stuff Person is doing

class Engineer(Person):
	def __init__(self):
		print(self.name)  # inherited from Person!
		super().__init__()

Image Reference

Image is taken from http://www.interskill.com.au/wp-content/uploads/2013/04/python-programming.jpg