How do I create a local server using python, and host HTML code on it? And in step by step, what would I need to do to create an HTML code with a chatbot (using some api()
Creating a local server using python is very easy, several packages allow it. Python even has a built-in webserver, which can be started by selecting the directory where python is located on your computer in the Windows Powershell (or the equivalent on MacOs or Linux) and typing in the code: 
 python3 -m http.server
However, for hosting code, it may be better to use packages. This is an example code using the http.server package (example taken from https://pythonbasics.org/webserver/):
 # Python 3 server example
from http.server import BaseHTTPRequestHandler, HTTPServer
import time

hostName = localhost
serverPort = 8080

class MyServer(BaseHTTPRequestHandler):
    def do_GET(self):
        self.send_response(200)
        self.send_header(Content-type, text/html)
        self.end_headers()
        self.wfile.write(bytes(<html><head><title>https://pythonbasics.org</title></head>, utf-8))
        self.wfile.write(bytes(<p>Request: %s</p> % self.path, utf-8))
        self.wfile.write(bytes(<body>, utf-8))
        self.wfile.write(bytes(<p>This is an example web server.</p>, utf-8))
        self.wfile.write(bytes(</body></html>, utf-8))

if __name__ == __main__:        
    webServer = HTTPServer((hostName, serverPort), MyServer)
    print(Server started http://%s:%s % (hostName, serverPort))

    try:
        webServer.serve_forever()
    except KeyboardInterrupt:
        pass

    webServer.server_close()
    print(Server stopped.)

What you would need to create an HTML code depends entirely on what the code is supposed to achieve. The code above just displays 'Request:/ example' and 'This is an example web server'. If you want to depict results from an API in HTML, you would have to tell the chatbot what type of data you received from your API.
Can you please use Markdown for the code example?
Sure, here's the same code in markdown:
```
from http.server import BaseHTTPRequestHandler, HTTPServer
import time

hostName = localhost
serverPort = 8080

class MyServer(BaseHTTPRequestHandler):
    def do_GET(self):
        self.send_response(200)
        self.send_header(Content-type, text/html)
        self.end_headers()
        self.wfile.write(bytes(<html><head><title>https://pythonbasics.org</title></head>, utf-8))
        self.wfile.write(bytes(<p>Request: %s</p> % self.path, utf-8))
        self.wfile.write(bytes(<body>, utf-8))
        self.wfile.write(bytes(<p>This is an example web server.</p>, utf-8))
        self.wfile.write(bytes(</body></html>, utf-8))

if __name__ == __main__:
    webServer = HTTPServer((hostName, serverPort), MyServer)
    print(Server started http://%s:%s % (hostName, serverPort))

    try:
        webServer.serve_forever()
    except KeyboardInterrupt:
        pass

    webServer.server_close()
    print(Server stopped.)
```