Learn · NPTEL

Course106108703219 lectures

Programming with Generative AI

Prof. Viraj Kumar · IISc Bangalore

Start with lecture 1 At NPTEL

About

Generative AI tools are being rapidly integrated into professional software development workflows because, for well-specified problems, they often (but not always!) write accurate code. To help students use generative AI tools effectively, this course teaches programming using such tools. It develops two essential skills that are under-emphasised in traditional programming courses: critiquing code (including AI-generated code) and asking clarifying questions.

Intended audience: Primary: Undergraduate Engineering students Secondary: Computer Science faculty

Prerequisites: High-school Mathematics

Lectures

Week 1 Part 1 Introduction

  1. What do Programmers Do? YouTube
  2. What is (and isn't) an algorithm? YouTube
  3. Algorithms for prime numbers YouTube
  4. Key Programming Trends YouTube
  5. Test Your Understanding YouTube
  6. How effective is GenAI at coding? YouTube
  7. Refuting an Algorithm YouTube
  8. Why is GenAI so effective at coding? YouTube
  9. Assumptions in AI-generated code YouTube
  10. Test Your Understanding YouTube
  11. Summary YouTube
  12. Python resources YouTube
  13. The REPL YouTube
  14. Basic Arithmetic Operators YouTube
  15. Test Your Understanding YouTube
  16. Complex Expressions YouTube
  17. Limits to arithmetic computation YouTube
  18. Investigation sys.float_info YouTube
  19. Binary digits (bits) YouTube
  20. Naming Things YouTube
  21. Introducing "our friend" YouTube
  22. Test Our Friend's Understanding YouTube
  23. Limits to float computation YouTube
  24. Python Objects YouTube
  25. Textual data YouTube
  26. Strings YouTube
  27. Summary YouTube

Week 2 Part 1 Variables and Assignments

  1. Evaluating a complex expression YouTube
  2. Assignment statements in Python YouTube
  3. Assignment statements and a common misconception YouTube
  4. Clarifying the misconception YouTube
  5. Another misconception with assignments YouTube
  6. A final misconception with assignments YouTube
  7. Introduction to PythonTutor YouTube
  8. Swapping two variables (incorrect) YouTube
  9. Swapping two variables (correct) YouTube
  10. Good, Poor, and Illegal Variable names YouTube
  11. Summary YouTube
  12. Representing complex programs abstractly as functions YouTube
  13. Properties of mathematical functions YouTube
  14. Other built-in functions YouTube
  15. The input function YouTube
  16. Celcius to Fahrenheit (buggy) YouTube
  17. Reviewing our friend's critique of buggy code YouTube
  18. Debugging the code YouTube
  19. Nested function calls YouTube
  20. AI-generated program 1 YouTube
  21. AI-generated program 1 YouTube
  22. Another example: Patient Data (buggy) YouTube
  23. Using ChatGPT to debug YouTube
  24. Fixing ChatGPT assumptions YouTube
  25. Using GitHub Copilot to debug YouTube
  26. Further model assumptions YouTube
  27. Fixing GitHub Copilot assumptions YouTube
  28. ChatGPT vs GitHub Copilot YouTube
  29. Summary YouTube

Week 3 Part 1 User-defined functions

  1. Poorly designed and well designed functions YouTube
  2. Principles of good function design YouTube
  3. Improvement 1 YouTube
  4. Improvement 2 YouTube
  5. Example of a poorly designed function YouTube
  6. Improvement 2 continued YouTube
  7. Improvement 3 YouTube
  8. Simple conditional statements YouTube
  9. Critiquing AI-generated code YouTube
  10. Complex conditional statements YouTube
  11. Introduction to Refute problems YouTube
  12. Summary YouTube
  13. Example 1 (is_multiple) YouTube
  14. Visualizing Example 1 YouTube
  15. Visualizing a function call YouTube
  16. The error in Example 1 YouTube
  17. Fixing the code YouTube
  18. Key Observations YouTube
  19. Example 2 (modified is_multiple) YouTube
  20. Fixing the error, Simplification 1 YouTube
  21. Elements of a Refute Problem YouTube
  22. Refuting the median function YouTube
  23. Simplification 2 YouTube
  24. Feedback for Refute Problems YouTube
  25. Attempting to refute YouTube
  26. Refuting the num_days function YouTube
  27. Critique our friend's function YouTube
  28. Boolean/logical operators YouTube
  29. Simplification 3 YouTube
  30. Identifying an unexpected behaviour YouTube
  31. Understanding and fixing the error YouTube
  32. Short-circuiting YouTube
  33. Inequivalence due to short-circuiting YouTube
  34. Summary YouTube

Week 4 Part 1 Helper functions and recursion

  1. Solving a problem with a helper function YouTube
  2. Calling a helper function YouTube
  3. Tracing a call to the helper function YouTube
  4. Definition of a leap year YouTube
  5. Refuting our friend's code YouTube
  6. Introduction to recursion YouTube
  7. Infinite recursion YouTube
  8. A correct recursive function YouTube
  9. Using the default visualization YouTube
  10. A non-recursive solution YouTube
  11. Refuting the buggy code YouTube
  12. Summary YouTube
  13. "Ask the Client" problems YouTube
  14. Clarifying the task YouTube
  15. Our friend's recursive function YouTube
  16. Tracing our friend's code YouTube
  17. Refuting our friend's code YouTube
  18. Clarifying questions: num_vowels YouTube
  19. Strings in Python YouTube
  20. Testing our understanding YouTube
  21. Testing out understanding further YouTube
  22. String operations and methods YouTube
  23. Testing your understanding YouTube
  24. Our friend's code: num_vowels YouTube
  25. Refuting our friend's code YouTube
  26. Immutable objects YouTube
  27. Summary YouTube

Week 5 Part 1 Lists, Tuples, and Exceptions

  1. Modifying existing code YouTube
  2. Poor code readability YouTube
  3. Improving code readability YouTube
  4. Asking clarifying questions YouTube
  5. Clarifying the code's expected behaviour YouTube
  6. Lists are mutable YouTube
  7. Step 1: Suggested modification YouTube
  8. Exceptions YouTube
  9. Tuples YouTube
  10. Sequence unpacking YouTube
  11. Summary YouTube
  12. A mystery (recursive) function YouTube
  13. Visualizing the mystery function YouTube
  14. A better (iterative) solution YouTube
  15. Visualizing a for-loop YouTube
  16. Pattern 1: Iterate until "success" YouTube
  17. Examples of Pattern 1 YouTube
  18. An error in AI-generated code YouTube
  19. A buggy function using Pattern 1 YouTube
  20. Refuting the buggy function YouTube
  21. Pattern 2: Accumulate YouTube
  22. The is_prime function YouTube
  23. Visualizing prime_product YouTube
  24. Another version of prime_product YouTube
  25. Visualizing the new version YouTube
  26. An example of Pattern 2 YouTube
  27. Another example of Pattern 2 YouTube
  28. Visualizing appending to a list YouTube
  29. Our friend's suggestion YouTube
  30. List comprehension YouTube
  31. A buggy function using Pattern 2 YouTube
  32. Refuting the buggy function YouTube
  33. An interesting takeaway YouTube
  34. Summary YouTube

Week 6 Iteration and Testing

  1. A recursive mystery function YouTube
  2. Iterative version YouTube
  3. Replacing while with for: Example 1 YouTube
  4. Replacing while with for: Example 2 YouTube
  5. Searching in a sorted list YouTube
  6. Implementing binary search YouTube
  7. The num_unique function YouTube
  8. Incorrect implementations of num_unique YouTube
  9. A correct implementation of num_unique YouTube
  10. Visualizing num_unique YouTube
  11. An important case (nobreak with no iterations) YouTube
  12. Pattern 3: All pairs YouTube
  13. Example (Pattern 3): max_profit YouTube
  14. Refuting the buggy function YouTube
  15. Representing tabular data YouTube
  16. Basic dict operations YouTube
  17. Example: substring_count YouTube
  18. Clarifying the task YouTube
  19. Reviewing ChatGPT's solution YouTube
  20. Test Driven Development YouTube
  21. Writing doctests for is_prime YouTube
  22. Summary YouTube

Week 7 Learning a new language (C)

  1. Clarifying the task: count_between YouTube
  2. Understanding the interpretation of "between" YouTube
  3. Are ChatGPT suggestions "good"? YouTube
  4. Generating the code after clarifying (using ChatGPT) YouTube
  5. Additional ChatGPT inputs YouTube
  6. Revised code after additional clarifications YouTube
  7. Learning a new programming language YouTube
  8. Python vs C: Similarities and differences YouTube
  9. Python: Example 1 YouTube
  10. Translating Example 1 to C YouTube
  11. Key syntactic differences: Python vs C YouTube
  12. Visualizing Python and C code YouTube
  13. C programming style YouTube
  14. Python: Example 2 YouTube
  15. Example 2, Attempt 2 YouTube
  16. Semantics of integer division YouTube
  17. Example 2, Attempt 3 YouTube
  18. Summary YouTube

Week 8 Part 1 Strings and functions in C

  1. Example 1 (is_upper) YouTube
  2. Visualizing the incorrect is_upper function YouTube
  3. Correcting the error YouTube
  4. Basics of strings in C YouTube
  5. Strings in C (char []) YouTube
  6. Strings in C (char *) YouTube
  7. Mutable and immutable strings YouTube
  8. Example 2 (to_ind_lower) YouTube
  9. Visualizing the modified to_ind_lower function YouTube
  10. Our friend's translation YouTube
  11. Visualizing our friend's translation YouTube
  12. Preventing accidental mutation YouTube
  13. Copying a string (Attempt 1) YouTube
  14. Copying a string (Attempt 2) YouTube
  15. Fixing one error, revealing another YouTube
  16. Allocating memory on the heap YouTube
  17. Visualizing the revised version (with malloc) YouTube
  18. Summary YouTube
  19. Algorithm-centric improvements (to_ind_lower) YouTube
  20. Data-centric improvements (to_ind_lower) YouTube
  21. Processing textual data: C or Python YouTube
  22. Understanding (simplified) Python lists YouTube
  23. A simple implementation of Python lists (Part 1) YouTube
  24. A simple implementation of Python lists (Part 2) YouTube
  25. A simple implementation of Python lists (Part 3) YouTube
  26. A simple implementation of Python lists (Part 4) YouTube
  27. Testing the list implementation YouTube
  28. Summary YouTube

Syllabus and materials

At NPTEL, as the course publishes them.

Credits and licence

Institution
IISc Bangalore
Department
Computer Science and Engineering
Teacher
Prof. Viraj Kumar
Level
Undergraduate
Language
English
Subjects
Computer science, Engineering
Source
NPTEL
Licence
CC BY-NC-SA, as NPTEL states it. Non-commercial use only. NPTEL's terms
Attribution
NPTEL states: "Distributed under Creative Commons Attribution-ShareAlike / CC BY - NC - SA", beside a BY-NC-SA badge.
Who can watch
NPTEL gives no rating. Invisible Network shows it to Tweens profiles and older, judged from what the source says about it. How courses are placed