Unit 7: Programming
β 5-Minute Coding Challenge: Build a Mini Chatbot
Students will:
- Write their first Python program
- Make the computer respond to their words
- Add simple logic in under 5 minutes
All using OneCompiler (Chromebook-friendly).
π¦ STEP 1 β Open OneCompiler
Tell students:
- Go to https://onecompiler.com/python
- Youβre ready β no setup, no logins.
π¦ STEP 2 β Generate the Base Program Using AI
Have students paste this into ChatGPT:
Prompt:
Write the simplest Python program that asks the user their favorite food and prints a fun response. Keep it extremely simple.
ChatGPT will return something like this:
|
1 2 |
food = input("What's your favorite food? ") print("Yum! I love " + food + " too!") |
Students should:
- Paste the code into OneCompiler
- Click Run
π The chatbot responds.
π¦ STEP 3 β Add Logic (Make It Smarter)
Now have students send ChatGPT this:
Prompt:
Now add simple logic: if the food is pizza, print a special funny message. Otherwise print a default message.
ChatGPT will return something like:
|
1 2 3 4 5 6 |
food = input("What's your favorite food? ") if food.lower() == "pizza": print("π Pizza lovers unite! Best food ever.") else: print(food + "? Nice choice!") |
Students:
- Paste
- Run
- Done
Now the chatbot responds differently depending on what they type.
π¦ STEP 4 β Personalize It (Make It Yours)
Tell students:
βMake your chatbot react to something you love.β
Prompt:
Change the program so it reacts to my favorite thing (my hobby, game, sport, etc.) and add emojis.
Suddenly, every studentβs code is unique π¨π