Slide 1

Slide 1 text

Ducks, interns, and Socrates: Using AI to enhance teaching and using Python Reuven M. Lerner • PyCon US Edu Summit https://LernerPython.com

Slide 2

Slide 2 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • Online courses at LernerPython.com • Newsletters: • Better Developers (about Python) • Bamboo Weekly (hardcore Pandas puzzles) • Trainer Weekly (about training) • Active on YouTube, Bluesky I teach Python and Pandas! 2

Slide 3

Slide 3 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • After decades of promises, AI has f inally arrived • It isn’t perfect, but it’s pretty good — and getting better fast • It’s making inroads into every aspect of our lives • This includes education • This includes coding • So it includes coding education AI is here 3

Slide 4

Slide 4 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • Should people still be learning to code? • Should AI play a part in our teaching? • What sort of role can and should it play? This raises lots of questions 4

Slide 5

Slide 5 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • People use it all of the time • Professional coders use it all the time • These tools are increasingly impressive • Asking students to ignore AI is • Unrealistic • Bad preparation for the real world “Just say no” isn’t an option 5

Slide 6

Slide 6 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • We aren’t (yet) in a world where AI can reliably and safely write our code • Vibe-coding is fun, but not serious • “Mostly works” is terrible for newbies • “Mostly works” is a complete non-starter for students And yet… 6

Slide 7

Slide 7 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • A tool is only as effective as its user • You can only use AI effectively if you have experience • Our job as instructors is to jumpstart that experience • Non-learning experiences • Driving vs. running • Eating vs. cooking Chatbots are tools! 7

Slide 8

Slide 8 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • Coding syntax and rules • How to break a problem apart • When to apply each data structure, tool, and technique • How to write maintainable, idiomatic code • Understand trade-offs • How to debug non-working code What should people learn? 8

Slide 9

Slide 9 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • AI is a terri f ic tool for helping people learn these points • But not by writing code! • You don’t learn any of the topics I just mentioned by reading AI- generated code • You can’t read or evaluate code without writing code yourself AI can help! 9

Slide 10

Slide 10 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com So, how can we use AI? How should we use AI? 10

Slide 11

Slide 11 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • I’ve started (slowly) to use some techniques in class • I’ve also been encouraging my students to use these • This is still very new • I’m still trying to f igure out the right balance and approach • I’m still learning from others, too! Metaphors and techniques 11

Slide 12

Slide 12 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • I use chatbots to copy-edit and tech-edit newsletters • I’ve never been called a genius so often in my life! • “That’s a great idea” might be true, but be careful… it might just be a very enthusiastic chatbot. Warning: You’re a genius! 12

Slide 13

Slide 13 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • Or: A newly minted research librarian • Very effective at f inding resources • You need to review, edit, and consider what they f ind • Sometimes completely made up • Often, links go to the wrong place • Use cases: • Find materials on a subject (then vet them) • Summarize a topic • New “reasoning” models are better at this AI: A very enthusiastic intern 13

Slide 14

Slide 14 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • I love using chatbots for brainstorming • After all, the point of brainstorming is to come up with new ideas, not necessarily great ideas • I often ask for 10-20 topics to explore Brainstorming partners 14

Slide 15

Slide 15 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • But often, especially in my courses for newbies, even seemingly easy exercises are really, really hard for them • The biggest problem: Where do we start? • I often run a strategy session with my students • But this feels like cheating — I’m breaking things down for them • AI can make it better and personal • Present a strategy • Have AI criticize it • Important: Tell the chatbot not to write any code! Strategy session 15

Slide 16

Slide 16 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • Pair programming works because you’re communicating • When you communicate, you’re forced to crystalize your ideas • “Rubber-duck programming” basically means pairing with yourself • You don’t have to wait for anyone else • You crystallize your ideas • Chatbots are great for this! • You have to write clearly… and they respond • But again, tell them to respond, not to write code Rubber-duck programming 16

Slide 17

Slide 17 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • I have LLMs do technical edits of my newsletters • Often, it’ll say, “You should do Y instead.” • I don’t accept it. I argue! I f ight back! • “Actually, I did X because of …” • Very often, the chatbot will say, “You’re right! That’s a much better solution.” • Teach your students to f ight with the chatbot. • It’s satisfying • It forces you to consider (and reconsider) your approach Argue! 17

Slide 18

Slide 18 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • Chatbots shouldn’t write code • But they can do a great job of reviewing code • What works well? • What could be better? • Be careful: Code reviews result in hallucinations • Again, it’s great to argue with the chatbot — don’t hold back! Review the code 18

Slide 19

Slide 19 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • After a student has solved a problem, then they can ask the chatbot to solve it instead — by entering the exercise question. • Students can compare the LLM’s results with their own • What’s better? • What’s worse? • What new things can they learn? • These comparisons make them more sensitive to trade-offs Compare results 19

Slide 20

Slide 20 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • I’m more willing to accept LLM-generated tests than code • (Testing experts, don’t kill me!) • Even so, the tests can be problematic • They don’t work • They’re overzealous • They don’t take advantage of parameterization • But: A large, automatically generated test suite with 100% coverage that passes is better than nothing • Reviewing, and considering, the tests is educational Writing tests? 20

Slide 21

Slide 21 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • The Socratic method: Ask your students directed questions, forcing them to think and develop their thinking • The Reverse Socratic method: Ask the LLM directed questions to research or learn a subject • Asking the questions crystallizes your thinking • Many questions (and answers) reduce the chance of LLM errors • Argue, summarize, and develop with prompts like: • Counter-examples (“but what about…”) • Summaries (“So what you’re saying is…”) • Comparisons (“So X differs from Y by …”) • It’s totally OK (crucial, even!) to say, “I don’t understand.” Reverse Socratic method 21

Slide 22

Slide 22 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • My favorite new technique! • Give a working program to the chatbot • Ask it to interview you about the program • Important: Tell it what level you’re at! (This might be the hardest part) • This is a great way to reinforce ideas in class • Plus: It solves the homework problem Interview 22

Slide 23

Slide 23 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com 23

Slide 24

Slide 24 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com 24

Slide 25

Slide 25 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com 25

Slide 26

Slide 26 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com 26

Slide 27

Slide 27 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • Chatbots are very powerful tools • Thinking of them as interns or brainstorming partners, rather than experts, is the key • Use them for in f initely patient interactions • Use them to improve critical thinking skills • These skills will give students what they need to use LLMs more effectively — even if they eventually have the LLMs write code Summary 27

Slide 28

Slide 28 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com 28

Slide 29

Slide 29 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com 29

Slide 30

Slide 30 text

Ducks, interns, and Socrates: PyCon 2025 Reuven M. Lerner • https://LernerPython.com • Let’s connect! • YouTube: https://YouTube.com/reuvenlerner • Bluesky: https://bsky.app/pro f ile/lernerpython.com • LinkedIn: https://linkedin.com/in/reuven • LernerPython: https://LernerPython.com Questions? Comments? 30