Skip to content

Instantly share code, notes, and snippets.

View calthoff's full-sized avatar

Cory Althoff calthoff

View GitHub Profile
authors = []
def collect_authors():
answer = None
while answer != "q":
answer = input("Who is your favorite author?")
authors.append(answer)
print(authors)
a = 0
def increment():
global a
a += 1
def increment(a):
return a + 1
shapes = [tr1, sq1, cr1]
for a_shape in shapes:
if type(a_shape) == "Triangle":
a_shape.draw_triangle()
if type(a_shape) == "Square":
a_shape.draw_square()
if type(a_shape) == "Circle":
a_shape.draw_circle()
shapes = [tr1, sw1, cr1]
for a_shape in shapes:
a_shape.draw()
class Shape():
def __init__(self, w, l):
self.width = w
self.len = l
def print_size(self):
print("""{} by {}""".format(self.width, self.len))
class Square(Shape):
pass
class Dog():
def __init__(self, name, breed, owner):
self.name = name
self.breed = breed
self.owner = owner
class Person():
def __init__(self, name):
self.name = name
class Rectangle():
def __init__(self, w, l):
self.width = w
self.length = l
def print_size(self):
print("""{} by {}""".format(self.width, self.length))
class Rectangle():
recs = []
def __init__(self, w, l):
self.width = w
self.len = l
self.recs.append((self.width, self.len))
def print_size(self):
print("""{} by {}""".format(self.width, self.len))
class Card:
suits = ["spades", "hearts", "diamonds", "clubs"]
values = [None, None,"2", "3", "4", "5", "6", "7", "8",
"9", "10", "Jack", "Queen", "King", "Ace"]
def __init__(self, v, s):
"""suit + value are ints"""
self.value = v
self.suit = s