Home › AI + Python: Build a Chai Chatbot › Lesson 1

Build a chai chatbot!

AI + Python: Build a Chai Chatbot, lesson 1 of 8. A short Hinglish video, simple English notes and code you can run, free.

Open the interactive lesson with Run button

The idea

A chatbot is a program that talks with you: you type, it replies.

You only need 3 things, all of which you learned in Python with Chai:

input() = listen · print() = reply · while True = keep going.

Our first Chai Bot is still simple: it says "Chai ready!" to everything. The next lessons make it smarter.

The code

while True:
    msg = input("Aap: ")
    if msg == "bye": break
    print("Bot: Chai ready!")

Output:

Aap: menu
Bot: Chai ready!
Aap: kaise ho?
Bot: Chai ready!
Aap: bye

Try it yourself

Remember

Chatbot = listen + reply + keep going.

Teach the bot to reply (if-else) →

All lessons: AI + Python: Build a Chai Chatbot