High School course

Python 101

  • GRADES 7+
  • ADVANCED
  • WEB
  • 13 LESSONS
Slide: 1 of 28

Answer Key

Module 3: Jungle Run

Module 4: More Dust

Module 5: Around the Corner

Module 6: Scale the Slopes

Module 7: Stairway to Safety

Module 9: Around the Bend

Module 10: Bunny Hop

Module 11: Naming Conventions

Module 12: Left-Right

Module 14: Quiz

1. An identifier cannot begin with a number. Which of the following is NOT a valid identifier?

  • num
  • _num
  • NUM
  • 1num_

2. An identifier can begin with an underscore (“_”).

  • True
  • False

3. An identifier can begin with a number.

  • True
  • False

4. In Python, an identifier may begin with an underscore or a letter. Which of the following is a valid identifier? Select all that apply.

  • _total
  • 2_count
  • NUM_COUNT
  • dollar_sign

5. Which of the following is a valid function call?

  • forwad)
  • tu-left()
  • forward()
  • forward(;

6. Select the following function calls that are invalid.

  • ford)(
  • $forDS()
  • forward()
  • turn_left()

7. How would you call a function named “my_function”?

  • Call my_function()
  • my_function
  • my_function))
  • my_function()

8. Identifiers in Python are case-sensitive.

  • True
  • False

9. 78090 is a valid identifier in Python.

  • True
  • False

10. Select the following invalid identifiers. (Identifiers are only allowed to start with an underscore or letter.)

  • &ident
  • 1ident
  • _ident
  • -ident

11. How would you move an object forward 3 times?

  • forward()
    forward()
    forward()
    
  • forward() * 3
  • Call_forward() 3 times
  • forward() {3}

12. You are not able to call the same function twice in a row.

  • True
  • False

13. You can replace the parentheses on a function call with square brackets.

  • True
  • False

14. The parentheses at the end of a function call are optional.

  • True
  • False

15. Which of the following is the correct way to start a multi-line comment?

  • '''
  • /*
  • #
  • //

16. Both of the following are valid ways to comment code:

# hello 
# world

'''hello
world'''

  • True
  • False

17. Which of the following comments are correct? Select all that apply.

  • // hello
  • # hello 
  • /*he
        llo */
  • //he
    llo// 

18. Commented lines affect the execution of your program.

  • True
  • False

19. What is the error in this code?

''' 
    This function does something
'''
def foo() :
    print("hello world") ''' print a message

  • The single line comment must use # instead of '''
  • The end of the multi-line comment cannot be on its own line
  • The beginning and end of the multi line comments are incorrect
  • All answers are errors in the code

  • 1.11 - Fix This Code! 1

Sample answer:

# modify these names to be snake_case 
shoe_size = 5 
my_age = 13 
def get_my_age(): 
    return my_age
  • 1.11 - Fix This Code! 2

Sample answer:

definitely = 4
print(definitely)
  • 1.11 - Do It Yourself

Sample answer:

definitely = 5
classic = 8
chocolate_cupcake = 9

print(definitely)
print(class)
print(chocolate_cupcake)

U.S. Standards

  • CCSS-ELA: SL.7.1, SL.8.1, RI.9-10.3, RI.9-10.6, L.9-10.3, L.9-10.6
  • CCSS-Math: HSN.Q.A.1, HSN.Q.A.2, HSN.Q.A.3, MP.1
  • CSTA: 2-AP-13, 2-AP-17, 3A-AP-17, 3A-AP-19, 3B-AP-11, 3B-AP-12, 3B-AP-24
  • CS CA: 6-8.AP.13, 6-8.AP.17, 9-12.AP.12, 9-12.AP.14, 9-12.AP.16
  • ISTE: 1.c, 1.d, 4.d, 5.c, 5.d

U.K. Standards

Key stage 3
Pupils should be taught to:
  • design, use and evaluate computational abstractions that model the state and behaviour of real-world problems and physical systems
  • understand several key algorithms that reflect computational thinking [for example, ones for sorting and searching]; use logical reasoning to compare the utility of alternative algorithms for the same problem
  • use 2 or more programming languages, at least one of which is textual, to solve a variety of computational problems; make appropriate use of data structures [for example, lists, tables or arrays]; design and develop modular programs that use procedures or functions
  • understand simple Boolean logic [for example, AND, OR and NOT] and some of its uses in circuits and programming; understand how numbers can be represented in binary, and be able to carry out simple operations on binary numbers [for example, binary addition, and conversion between binary and decimal]
  • understand how instructions are stored and executed within a computer system; understand how data of various types (including text, sounds and pictures) can be represented and manipulated digitally, in the form of binary digits
Key stage 4
Pupils should be taught to:
  • develop their capability, creativity and knowledge in computer science, digital media and information technology
  • develop and apply their analytic, problem-solving, design, and computational thinking skills

Lesson 1: The Basics

Course: | Web

  • Welcome
  • Course Overview
  • Jungle Run
  • More Dust
  • Around the Corner
  • Scale the Slopes
  • Stairway to Safety
  • What are Comments?
  • Around the Bend
  • Bunny Hop
  • Naming Conventions
  • Left-Right
  • Review
  • Quiz

Description

In this introduction to Python for intermediate or advanced coders in upper middle or high school, students will be learn to code in Python. As they complete this advanced lesson plan, they will enjoy engaging lessons, solve challenging puzzles, and build their own games in Python. This course is ideal for students who have already completed at least one Tynker course and are comfortable with the basics of programming logic and computational thinking. This course will help them learn how to code Python and adapt to the additional challenges of text-based syntax.

Students who successfully complete this lesson plan will demonstrate a strong mastery of Python syntax, as well as the ability to creatively program games and other projects and debug their own code. Students will also be able to come up with an idea for a Python game and take it through the entire design and implementation process, creating custom versions of many of their favorite games in Python.

Topics

  • Python syntax
  • Sequencing
  • Repetition
  • Conditional logic
  • Nested loops
  • Automation
  • Pattern recognition
  • Simple motion
  • Keyboard and mouse events
  • Pen drawing
  • Operators
  • Expressions
  • Variables
  • Turtle graphics
  • Using arrays and objects to store structured data

What Students Learn

  • Learn Python syntax
  • Use conditional logic, loops, and conditional loops to solve problems
  • Create and use variables
  • Detect and handle keyboard and mouse events
  • Write and interpret Python expressions
  • Use pen drawing and Turtle graphics to draw shapes and display images
  • Detect win/loss conditions in a game
  • Implement collision detection between images
  • Use arrays, dictionaries, and objects to store structured data

Technical Requirements

* Online courses require a modern desktop computer, laptop computer, Chromebook, or Netbook with Internet access and a Chrome (29+), Firefox (30+), Safari (7+), or Edge (20+) browser. No downloads required.