Skip to content

Instantly share code, notes, and snippets.

@espinz
Created November 9, 2019 18:57
Show Gist options
  • Save espinz/73851d113dc4fb75e5ee808b48f5cc06 to your computer and use it in GitHub Desktop.
Save espinz/73851d113dc4fb75e5ee808b48f5cc06 to your computer and use it in GitHub Desktop.
Classes Exercise
class Shapes:
"""A shapes class."""
def __init__(self):
self.question = input('What is your favorite type of shape? ')
self.triangle = "triangle"
self.square = "square"
self.circle = "circle"
def shape_type(self):
print('Your favorite shape is a', end=' ')
if self.question == self.triangle:
print(f'{self.triangle}')
elif self.question == self.square:
print(f'{self.square}')
else:
print(f'{self.circle}')
my_shape = Shapes()
my_shape.shape_type()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment