Another rewarding day in the fast-paced world of WebDev. Man, you love your job! But as with any job, somtimes things can get a little tedious. Part of the website you're working on has a very repetitive structure, and writing all the HTML by hand is a bore. Time to automate! You want to write some functions that will generate the HTML for you. 

To organize your code, make of all your functions methods of a class called HTMLGen. Tag functions should be named after the tag of the element they create. Each function will take one argument, a string, which is the inner HTML of the element to be created. The functions will return the string for the appropriate HTML element.

For example, 

In JavaScript:

In Python:
```python
g = HTMLGen();
paragraph = g.p('Hello, World!')
block = g.div(paragraph)

# The following are now true
paragraph == 'Hello, World!'
block == 'Hello, World!'
```

Your HTMLGen class should have methods to create the following elements:

  * a
  * b
  * p
  * body
  * div
  * span
  * title
  * comment

Note: The comment method should wrap its argument with an HTML comment. It is the only method whose name does not match an HTML tag. So, ```g.comment('i am a comment')``` must produce ``````.

Difficulty: introductory

Starter code:

def __init__(self):
	

Solutions:
class HTMLGen:
    def __init__(self):
        self.a = lambda t: self.tag("a", t)
        self.b = lambda t: self.tag("b", t)
        self.p = lambda t: self.tag("p", t)
        self.body = lambda t: self.tag("body", t)
        self.div = lambda t: self.tag("div", t)
        self.span = lambda t: self.tag("span", t)
        self.title = lambda t: self.tag("title", t)
        
    def tag(self, tag_str, content):
        return "<{}>{}</{}>".format(tag_str, content, tag_str)
        
    def comment(self, content):
        return "<!--{}-->".format(content)

class Tag:

    def __init__(self, name):
        self.template = '<{0}>{{}}</{0}>'.format(name) if name != 'comment' else '<!--{}-->'
      
    __call__ = lambda self, content: self.template.format(content)


class HTMLGen:
    __getattr__ = lambda self, name: Tag(name)

class HTMLGen:
    def __init__(self):
        tags = ['a', 'b', 'p', 'body', 'div', 'span', 'title', 'comment']
        for tag in tags:
            setattr(self, tag, lambda content, tag=tag: '<'+tag+'>'+content+'</'+tag+'>' if not tag == 'comment' else '<!--'+content+'-->')