Lesson 3.3 Learning Algorithms in Coding with AI Tools like ChatGPT

Lesson 3.3 Learning Algorithms in Coding with AI Tools like ChatGPT

Writing and Converting Pseudocode

Objective: Students create pseudocode for a simple problem and convert it into Python code with ChatGPT's assistance.

1.      Activity: Writing Pseudocode (20 minutes):

    • Students individually write pseudocode for the AnimalSound problem:
      • Example:
START
INPUT animal
IF animal == "cat" THEN
    OUTPUT "Meow! Meow! Meow!"
ELSE IF animal == "dog" THEN
    OUTPUT "Bark! Bark! Bark!"
ELSE
    OUTPUT "Unknown animal"
END IF
END

2. Introduction to Computational Notebooks (10 minutes):

    • Teacher introduces Google Colab and Jupyter Notebook as tools for interactive coding.
    • Demonstrates how to create and run cells in these environments.

3.      Activity: Translating Pseudocode to Python (20 minutes):

    • Students use ChatGPT to translate their pseudocode into Python code.
    • Example Python Code:
python
animal = input("Enter an animal (cat or dog): ")
if animal.lower() == "cat":
    print("Meow! Meow! Meow!")
elif animal.lower() == "dog":
    print("Bark! Bark! Bark!")
else:
    print("Unknown animal.")
Students test their code in Google Colab or Jupyter Notebook.

You have completed 0% of the lesson
0%