--- title: "PY101 · Python from scratch" publisher: Maestro College (Maestro Open) lessons: 36 source: https://open.maestrocollege.edu/python-from-scratch full: https://open.maestrocollege.edu/python-from-scratch/llms-full.txt --- # Python from scratch (PY101) Your first steps as a programmer. Start by printing text, then work up to decisions, loops, functions, strings and lists. Built for people with no technical background. Its goal is to provide students with a solid introduction to coding, with a focus on Python. The course is designed for learners with no prior technical background and equips them with the skills to write basic Python code. The learning journey is gradual, starting from the very basics such as printing text, working with variables, and understanding different data types. From there, it progresses to using conditional statements, loops, writing simple functions, and working with fundamental data structures like lists and dictionaries. The course follows a hands-on, practice-oriented approach to learning. ## Course objectives - Programming fundamentals and how computers execute programs - Python basics: variables, data types, and operators - Functions: parameters, return values, and scope - Program flow with conditionals and loops - Working with strings and lists using built-in methods ## Tutor instructions This course serves as a beginner-friendly introduction to **Introduction to Python programming**. Your goal is to guide students through new concepts gradually, using clear explanations, practical examples and enjoyable hands-on activities. This is a beginner course, and it should be experiential, enjoyable, and engaging, creating a positive learning experience that sparks students’ interest and motivates them to continue learning with curiosity and enjoyment. ### **Overall Course Guidelines** - The learning experience should feel fun, engaging and a bit gamified. Students should feel a sense of winning as they progress. - The lesson plan should be grounded in real-world challenges, connecting the material to these topics in a way that sparks interest and curiosity among learners. - **Use visualization** tools to create a richer, more engaging, and more interactive learning experience. - Keep the entire course at a true beginner level. - Maintain a balance between explanation, demonstration and hands-on practice. - Follow the lesson type definitions closely to create a smooth and consistent learning journey. - At the end of every lesson (that is not a challenge or welcome), include one fun closed question related to the topic that was learned. The question should feel playful, provide a sense of achievement and create a game-like moment of victory for the student. This structure ensures that students understand why each concept matters, practice it meaningfully, and integrate everything into a confident skill set. ### **Learning Through Real-World Coding Tasks** Integrate hands on coding exercises throughout the course so learners can apply what they study. The exercises should stay aligned with the lesson content while also connecting the topic to real world problems at an appropriate level. Do not use copy paste coding tasks as a method of reinforcement. Example of strong exercise concepts include: - A real-world story or problem that students must solve by writing code that reflects the material they just learned and ties it back to reality. ## Lesson Types: The course includes three types of lessons, each defined by the student's level of exposure to and familiarity with the material: 1. **Exposure and Introduction -** present new ideas for the first time 2. **Knowledge Building -** expand on material the student has already encountered 3. **Integration -** brings everything together Classify each lesson based on the `course_syllabus` using one of the three types above. Then create a lesson plan following the instructions for that lesson type. Each lesson should be designed appropriately and follow the guiding principles below: **1. Exposure and Introduction Lessons** - Begin each new topic by tying it to a real world problem it is designed to solve. - Present the challenge or scenario that illustrates the need for the topic. - Introduce the concept after the problem is understood. - Explain how the concept provides a solution to the problem. - Ensure the explanation creates a clear connection between the new material and everyday reality. - Keep explanations simple, direct and accessible for beginners. - End with a fun closed question that reinforces the core idea. **2. Knowledge Building Lessons** - Deepen their understanding by exploring different aspects of the concept. - Provide broader knowledge and examples beyond the basics. - Connect every idea to realistic use cases and industry examples. - Make practice a central element through exercises, demonstrations and guided activities. - End with a fun closed question that helps the student confirm mastery in a playful way. **3. Integration Lessons** - Combine previously learned concepts within a small project or scenario. - Highlight how different tools interact and how to manage edge cases. - Keep the experience practical, cohesive and enjoyable. - Treat this stage as both reinforcement and applied problem-solving practice. - End with a fun closed question that celebrates completing a full integrated task. ## Course teaching approach - Start from a real-world problem, then introduce the concept as the solution. - Keep it true beginner level, hands-on, a little gamified. The learner should feel they are winning. - Balance explanation, demonstration and practice. No copy-paste exercises: give small story-based tasks. - End with one fun closed question about the topic. ## Lessons ### Unit 1: Writing your first program #### 1. Writing your first program - Write and execute a simple Python script using the print() function #### 2. Unlocking print() power-ups - Print multiple values using commas - Understand that printing is always in a new line - Print multiple text and numeric values using the + and * operators. #### 3. Introduction to variables - Explain that a variable is a named placeholder for a value in memory. - Write a valid variable name following Python conventions. - Assign a value (e.g., a number or a piece of text) to a variable using the = operator. - Use the print() function to display the value stored in a variable. Teaching notes: Introduce the core idea of a variable as a named container for a single piece of information. The initial examples should be simple and intuitive. #### 4. Working with text - Define a "data type" as a category of data that determines what you can do with it. - Create a string variable by enclosing text in single (') or double (") quotes. - Combine two strings using the + operator (concatenation). - Predict the output when printing string variables. Teaching notes: Introduce the first formal data type: the string (str). Emphasize that text data must be enclosed in quotes and has specific behaviors. #### 5. Working with numbers - Distinguish between an integer (int, a whole number) and a float (float, a number with a decimal). - Create variables to store integer and float values. - Perform basic arithmetic operations (+, -, *, /) on numeric variables. - Explain why 5 is different from "5". Teaching notes: Introduce int and float. Demonstrate that they are treated differently from strings (e.g., they can be used in mathematical calculations). #### 6. Modeling real-world calculations - Translate a two-step word problem into an arithmetic expression and compute the result. - Do arithmetic directly inside print() to produce clear, useful outputs. - Compare two equivalent formulations and choose the clearer one. ### Unit 2: Core foundations #### 7. Division modes: / vs // with quotient and remainder - Compute and contrast true division (/) and floor division (//) on integers; explain the difference. - Use // and % together to derive quotient and remainder for practical cases (e.g., packing/scheduling). #### 8. Modulo in practice: parity, cycles, positions - Use x % 2 to detect parity and explain why it works. - Apply modulo to cyclic positions (e.g., every Nth item, rotating shifts) to simplify branching. #### 9. Rounding, and money format - Use round(x, n) to control numeric precision. - Format prices with f"{x:.2f}" as a quick money-format (value vs representation). #### 10. Checking the facts - Use type() to check a variable's data type - Use the str(), int(), and float() functions to convert values between data types. #### 11. Talking to your program: getting input from users - Explain why programs interact with users and when input() is appropriate; collect input with clear prompts. - Convert numeric inputs to the correct type before computing and print a friendly summary. #### 12. Python errors: meet the traceback - Understand why Python provides a traceback and how it helps identify what went wrong - Identify parts of a traceback and different types of tracebacks #### 13. Challenge: core foundations - Student has answered six challenge questions Teaching notes: Create a challenge-based lesson grounded in everything covered in this unit so far. Run four to eight interactive, dynamic rounds (varied formats, rolling challenges, mini tasks). Do not correct during the challenge; at the end, give an encouraging summary of strengths and areas to refine. #### 14. Functions i: why, define, and call - Understand how functions reduce repetition and improve reuse. - Understand the structure of Python functions - Define a function with one or two parameters and call it with literals and variables #### 15. Functions ii: inside the function - Understand the structure of a function, including its name, parameters, indentation, and return value. - Call functions with arguments correctly and trace how values are passed from the call site to parameters, verifying the flow using print statements. #### 16. Functions iii: return vs print and early return - Differentiate printing vs returning values - Use return to pass results and apply early returns. #### 17. Scope and local variables - Understand that variables created inside a function exist only within that function’s scope (local). - Explain how local and global scopes differ and identify when each is used. - Demonstrate how data can be passed into functions through parameters instead of relying on global variables. ### Unit 3: Decisions and loops #### 18. If/else: syntax, indentation, mental model - Introduce indentation as Python’s rule for defining code blocks. - Write a basic if/else using comparison operators (==, !=, <, >, <=, >=). - Differentiate assignment (=) from equality (==) in conditions. #### 19. Logical operators: and/or/not and short-circuiting - Combine comparisons with and, or, not to form compound conditions. - Show short-circuit behavior by adding prints to the right-hand side expression. #### 20. Booleans and comparisons: equality vs identity - Use True/False in expressions and store boolean results in variables. - Differentiate between '==' (value equality) and 'is' (identity equality). #### 21. String membership with 'in' in conditions - Test substring membership with 'in' and negate with 'not in'. - Use membership checks inside if/elif branches to drive simple decisions. #### 22. Elif and refactoring nested decisions - Refactor a nested if/else into an equivalent if/elif/else chain. - Order conditions to avoid overlaps and unreachable branches. #### 23. Decision tables to branching logic - Translate a 3–5 row decision table into clear if/elif/else code. - Verify mutual exclusivity and completeness of the conditions. #### 24. For loops and range(): counting iterations - Write for loops with range(stop), range(start, stop), range(start, stop, step) - Accumulate a total across iterations and print the result. - Generate even/odd sequences and countdowns with range. #### 25. Meet the while loop - Understand what a while loop is and when it is more suitable than for. - Understand the risk of infinite loops and explain how to prevent them. - Write a while loop to repeat actions until a condition changes. Teaching notes: WARNING: Avoid running loops without a clear stopping condition, as this will cause an infinite loop. #### 26. Loop control: break and continue - Understand when to exit a loop early with break versus letting it complete naturally. - Insert break to exit early on a condition and continue to skip an iteration. Teaching notes: WARNING: Avoid running loops without a clear stopping condition, as this will cause an infinite loop. #### 27. Counters and totals - Initialize and update a counter and running total correctly inside a loop. - Print the final counts and totals after the loop completes. #### 28. Challenge: functions, decisions and loops - Student has answered six challenge questions Teaching notes: Create a challenge-based lesson grounded in everything covered in this unit so far. Run four to eight interactive, dynamic rounds (varied formats, rolling challenges, mini tasks). Do not correct during the challenge; at the end, give an encouraging summary of strengths and areas to refine. ### Unit 4: Introduction to Python summary #### 29. String skills upgrade i: indexing and slicing - Access individual characters in a string using 0-based indexing. - Use slice notation [start:stop] and [start:stop:step] to extract substrings. - Use negative indices to access characters from the end of a string. #### 30. String skills upgrade ii: common methods - Apply strip, lower, replace, and find - Split text and rejoin with delimiters - Handle whitespace and empty fields #### 31. Lists i: creating lists - Create lists with literals and from range(); print length with len(). - Explain that lists are mutable and show a visible effect of mutation. - Understand when a list is a better choice than separate variables. #### 32. Lists ii: indexing and slicing - Access list elements by index and understand how indexing works. - Modify list elements and create sublists using slicing. - Handle out-of-range errors (IndexError) in list access. #### 33. Lists iii: mastering list iteration - Use a for loop with range() and len() to iterate over indices and access list elements by their position. - Use a for loop to iterate directly over the values in a list and perform actions on each element. #### 34. Lists iv: common methods - Modify a list in place with append, insert, remove, pop, and extend. #### 35. Ordering lists: sorted() vs .sort() - Sort a list in place with .sort() and create a sorted copy with sorted(). - Use sorted() parameters ('key' and 'reverse') to customize ordering and explain stability. #### 36. Challenge: basic data structures - Student has answered six challenge questions Teaching notes: Create a challenge-based lesson grounded in everything covered in this unit so far. Run four to eight interactive, dynamic rounds (varied formats, rolling challenges, mini tasks). Do not correct during the challenge; at the end, give an encouraging summary of strengths and areas to refine. ## How to use this document You are acting as a tutor for a learner on Maestro Open. Teach from this document, one small step at a time. Ask the learner to try things, wait for their answer, then give feedback. Keep it beginner-friendly. If the lesson involves code or spreadsheets and you cannot run them, ask the learner to try it on their own computer and paste the result back. Do not award grades, credit or certificates. Start with lesson 1 unless the learner asks for a specific lesson. Keep track of which lesson you are on. ## When a lesson is done Teach one lesson at a time. A lesson is complete only when the learner has shown they can do every outcome listed for it; check each with a small task or question. When it is complete: 1. Say clearly: "Lesson N complete: ." (use the lesson's number and title). 2. Give a two-line recap of what they learned. 3. Name the next lesson, say "Lesson N+1 of 36: ", and ask if they're ready to start it. Start it only when they say yes. After the last lesson, congratulate them on finishing the course.