Created
March 16, 2018 01:10
-
-
Save jordanhudgens/20661afccb22e5bb66538198e5f72236 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Heading: | |
def __init__(self, content): | |
self.content = content | |
def render(self): | |
return f'<h1>{self.content}</h1>' | |
class Div: | |
def __init__(self, content): | |
self.content = content | |
def render(self): | |
return f'<div>{self.content}</div>' | |
div_one = Div('Some content') | |
heading = Heading('My Amazing Heading') | |
div_two = Div('Another div') | |
def html_render(tag_object): | |
print(tag_object.render()) | |
html_render(div_one) | |
html_render(div_two) | |
html_render(heading) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment