Welcome to Python
Use the computer's built-in function to display output, and practice writing correct and readable programs.
Introduction: Python 201Welcome to Python 201, Tynker's second Python course for schools. Python 201 prepares students for the rigors of AP Computer Science, quickly diving into the syntax and functionality of the Python language. We recommend Python 201 for intermediate or advanced coders (grades 8+) who are comfortable with basic programming concepts and have completed at least one of our block-based coding courses. As a complement to Python 101, which approaches Python as a tool to build games and solve visual puzzles, Python 201 takes a more traditional computer science approach. The course teaches Python from the ground up and shows students how they can apply advanced coding concepts to solve real-world problems.
Topics covered: Python syntax, variables, data types, math operators, boolean logic, Turtle graphics, branching, while loops, for loops, strings, lists, dictionaries, functions, classes, objects, and recursion
- 15 scaffolded, self-guided lessons
- 15 lesson guides (one for each lesson) that will give you an overview of the vocabulary introduced in the lessons and suggestions for how to support your students through each lesson
- Answer keys for all activities
Answer Key Information:The answer keys in Python 201 are a bit different than in other Tynker courses. To see solutions for each of the activities, log into your teacher account and access the preview for a lesson. You will see a button called "show solution" under each activity that your students need to enter code for. Click on the button to see the solution.
Lesson: Welcome to Python
Time: 40+ mins
- Python: Python is a programming language that is widely used in web development, game development, and scientific research. Python is known for being highly readable and uncluttered, using whitespace indentation instead of curly braces or keywords. Because the Python language is meant to be relatively syntactically simple, Python developers use the invented adjective “pythonic” to describe code that is highly readable and written in a way that shows fluency with Python idioms.
- Computer Science: Computer science is the study of computers and computation systems. Computers scientists mostly study and work with software and software systems, creating programs that accomplish different tasks.
- Instruction: An instruction is a single unit of work for a computer. Each instruction is read by a computer, translated into machine language, and executed.
- Value: A value is a single unit of information like literal text enclosed in quotations ("hello") or a number (42).
- Function: A function is a specific action that a computer knows how to perform. A function must be defined somewhere in the code and when a function is called, it will use the instructions that are stored in the function definition.
- Function Call: A function call is an instruction that tells the computer to perform a specific function. The function call must use the name of the function followed by a set of parentheses. A function call may or may not have a value inside the parentheses, depending on the function definition.
- Program/Code: A program is a sequence of instructions that a computer will execute. A program is sometimes referred to as code.
- Executing a program: When a computer executes a program, the computer is performing each instruction one at a time.
- Argument: An argument is the value that is inside the parentheses when a function call is made. For example, in the function call print(42), the argument is the value 42.
- Integer: In programming, an integer is a specific data type that stores a whole number. Just like an integer in math, in programming, an integer can be positive or negative.
- String: In programming, a string is a specific data type that stores a series of letters or characters. In other words, strings are groups of text. Strings must be enclosed in quotations.
- Syntax: Syntax is the set of rules that govern how a language is structured. All languages have a syntax. In English, sentences have a syntax that may involve subjects, verbs, and objects. Python syntax is a set of rules that define what correctly formatted code looks like. But if you write a sentence in English with incorrect syntax, someone still might understand what you’re saying. If you write a line of code in Python with incorrect syntax, your program won’t run!
- Syntax Error: An error in the syntax of your code
- Comment: Certain symbols in code communicate to the computer that anything after them should be ignored when it executes your program. This allows you to document your code by adding comments, which will help you debug your work and help other people understand what your code does. In Python, single line comments are started with a pound sign (#).
- Use Python instructions to display different values
- Combine multiple instructions to create short computer programs
- Document their code with comments to explain what they are doing
- Analyze the error messages that appear after executing code
- Fix syntax errors based on feedback from error messages
- Computers (1 per student) with student account access to Tynker.com
Warm-Up (5 minutes)1. Ask students what they think of when they hear the phrase “text-based programming languages.”
2. Write their answers on the classroom board. Discuss.
3. Explain that Python is an example of a text-based programming language.
5. Say, “Today, we’re going to take a more traditional computer science approach as we explore Tynker’s Python 201 course. Let’s get started!”
Activities (35 minutes)Facilitate as students complete the Welcome to Python modules on their own:
1. Introduction (Document)
- Students will read a short introduction that explains the Python 201 course.
- Tell students to click the orange “Next” button (located at the bottom) to move to the next module.
- This module introduces students to outputs.
- Tell students to click the orange “play” button to instruct their computer to perform the given instruction.
- Are students struggling to print their name? Give a hint: Tell them to use the code listed above as a reference.
- This module introduces students to functions and function calls.
- Check that students are clicking the orange “play” buttons to instruct their computer to perform the given instruction.
- Ask students, “What’s a program? What’s another name for it?” (A sequence of instructions is called a program, and is sometimes referred to as code)
- Are students struggling to print the name of their favorite author, artist, and historical figure on separate lines? Give a hint: Tell them to use the code in the "Multiple Instructions" section as a reference.
- This module introduces students to arguments.
- Ask students, “What are function calls?” (An instruction that tells the computer to perform a known action with some value)
- Are students are struggling with the two puzzles? Give a hint: Tell them to use the code in the examples as a reference.
- Students will read a short document that introduces syntax.
- In this module, students will need to apply syntax knowledge to fix the syntax errors in the “Function Call” section. Additionally, students will need to fix the syntax errors in the “Syntax Errors” puzzle.
- In this DIY (do-it-yourself) module, students will learn about comments and create their own artwork by printing characters.
- Check that students are adding comments to their program.
- Remind students to click the “submit project” button when they are done.
- Students will be asked 3 quiz questions to review concepts from this lesson.
- Quiz questions involve printing the name of a country, identifying the correct definitions of a “value,” and printing a 3 x 3 cube of asterisk ( * ) characters.
Discussion Questions/Follow-Up Activities (20 minutes)
- Create a class K-W-L chart, which tracks what the class knows (K), wants to know (W), and has learned (L) about programming. Ask students what they know about coding and programmers, and write their responses in the “K” column of the chart. Next, ask students what they want to know, and write their responses in the “W” column of the chart. Add to the “L” column of the chart after each Tynker lesson.
- CCSS-ELA: SL.8.1, RI.9-10.3, RI.9-10.6, RI.11-12.3, RI.11-12.6, L.9-10.3, L.9-10.6, L.11-12.3, L.11-12.6
- CCSS-Math: HSN.Q.A.2, HSN.Q.A.3, MP.1, MP.2
- CSTA: 2-AP-13, 2-AP-16, 2-AP-17, 2-AP-19, 3A-AP-17, 3B-AP-11
- CS CA: 6-8.AP.13, 6-8.AP.16, 6-8.AP.17, 6-8.AP.19, 9-12.AP.12, 9-12.AP.16
- ISTE: 1.c, 1.d, 4.d, 5.c, 5.d, 6.b
Welcome to PythonPython 201
- 7 Activities
- 1 Completion Badge