• Welcome to Python Sequencing Puzzles Part 1 Python Conventions Sequencing Puzzles Part 2 Review and Quiz Unit 1 Project

Sequencing Puzzles Part 1

In this lesson, you will learn the following:

  • Function Calls
  • Sequencing
  • Syntax and Debugging

Here are a few tips to help you with this learning activity:


  1. Read the Directions Each small task in the activity will ask you to solve a puzzle by accomplishing a given task. Read the directions carefully. If you are having trouble with a puzzle, consider reading the directions out loud.
APCSP


  1. Think Literally When you tell a computer to do something through code, the computer does not really know what your mind is thinking, it only knows what commands you are giving to it. Being detail-oriented really helps here.
APCSP


  1. Double-check Your Typing If you are talking to someone and you say a word incorrectly, the person can usually figure out what you really meant. This is NOT true for a computer. Any one small mistake can really confuse it. In particular, a typing mistake, such as spelling a word incorrectly, forgetting a symbol, or not following the rules for indentation, can cause the computer to not understand anything in your entire program.
APCSP


  1. Expect to Have Errors Unlike other tasks that you might do in school, it is really common to not write a correct program the first, second, or even third time! Be patient and expect to make mistakes.
APCSP

Let's get started!

Next
© Tynker, 2020

Cyber Trap

Jean and her friends were somehow transported into their school's computer lab!


Cyber Trap


Avoid the evil Megabytes and collect the memory chips—help Motherboard regain her lost memory. Can you help Jean restore the balance and return to reality?


Cyber Trap character walking forward

Jump obstacles!

Cyber Trap character stunning enemies

Blast baddies!


Oh, and just one more thing: Stay on the path!

Previous Next
© Tynker, 2020

Function Calls

In the previous lesson, you learned that functions can be called, and they will execute one-at-a-time.

Sequencing

Sequencing describes the order of events or code instructions. In short, when a program runs, each individual instruction in the program will be executed, one after the other. This is called its sequence.

APCSP

Hint: You’ll often have to rearrange code instructions and experiment with the sequence of your code.

Your First Puzzle

In this challenge sequence, you'll take control of the player character shown below. Your goal is to reach the card at the end of the path — that's a memory chip!

You can move the characters around on the game grid using code! This first puzzle has already been solved for you. Notice how the code appears at the bottom. In the next puzzle, you'll need to write Python code yourself.

Press run to watch the solution play. Click Next to continue.

Previous Next
© Tynker, 2020

Inside the Computer

Use the forward() function to reach the memory chip.

  • Each time you use this function, the player moves one block forward.
  • Write your code in the code area below. Then press run to run your code.

Available Commands

Command Description
forward() Moves the character one step forward.

Hints

  • When you're using programming languages like Python, the details really matter. If you misspell one word, or if you forget even a little bit of punctuation, your code won't run!

  • If you get an error, check your code closely for errors.

To move the character one step forward, you need to type the forward() command in the coding area.

  1. Write the forward() function twice. Don't forget the parentheses!
  2. Each time you use this function, put it on on a new line.
Previous Next
© Tynker, 2020

More Memory Chips

Use the forward() command to reach the memory chips.

Available Commands

Command Description
forward() Moves the character one step forward.

Hints

  • You'll need to use the forward() function three times, putting each command on a new line.

  • When you're using programming languages like Python, the details really matter. If you misspell one word, or if you forget even a little bit of punctuation, your code won't run!

  • If you get an error, read your code closely for errors. Make sure you don't forget the parentheses.

Previous Next
© Tynker, 2020

Around the Corner

Navigate the corner using the turn_right() command and get that memory chip!

Available Commands

Command Description
forward() Moves the character one step forward.
turn_right() Turns the character to the right.

Hints

  • The turn_right() command will turn the character to the right.
Previous Next
© Tynker, 2020

Scale the Slope

Reach the memory chip. Just be sure to stun those Megabyte Chompers!

Available Commands

Command Description
forward() Moves the character one step forward.
stun() Launches an stun bolt that travels 5 blocks in the direction the character is facing.

Hints

  • Don't get eaten by the Megabytes! Use the stun() command to get rid of them.
Previous Done
© Tynker, 2020
Sign in
Don't have an account?