Home › Python with Chai › Lesson 20

Finale: you know Python!

Python with Chai, lesson 20 of 20. A short Hinglish video, simple English notes and code you can run, free.

Open the interactive lesson with Run button

The idea

Parts 1–10, the basics: variables, functions, if-else, lists, for loops, dictionaries, input, try-except and while True.

Parts 11–19, the pro moves: files (r, w, a), import random, f-strings, range(), default values, sets, datetime and classes.

Small ideas combine into real programs. Next stop: the AI + Python course, where the chai shop gets its own chatbot.

The code

import random

for i in range(1, 4):
    chai = random.choice(["Masala", "Adrak"])
    print(f"Cup {i}: {chai}")

Output:

Cup 1: Adrak
Cup 2: Masala
Cup 3: Masala
(random: your cups will be different)

Try it yourself

Remember

You know Python. Next: AI + Python, the chai chatbot.

← Classes: the chai shop

All lessons: Python with Chai