Coding for KidsCoding for Kids
Creative LevelsChallengesTeacher's Guide
Vote for features
Python Development Course
Chapter
>
Level

Introduction to Python
Movement with Functions

You're lost in the woods! Make your way out and get back to your farm by writing your first lines of Python code!

Python is an all use programming language you can use for a variety of apps including games!

Your first task is to make your way to the star using code to complete the level!

If you get stuck, try pressing the Help button in the upper right corner of the screen or press the Code Book button for illustrated explanations of all the codes used in the game.

You can also receive help from the Virtual Teacher, this feature will generate tips via popups in the code editor guiding you through the coding process. You can turn it on and off by switching the teacher icon located on top of the editor. The coin icon next to it informs you of how many tips you are eligible to receive.

Guide

Objective

Traverse the forest path and reach the exit to complete the level.

How can you get across the forest? By using Functions of course!

Functions are useful code commands that influence the world around you. These commands are typed in the editor below.

In the programming language Python, the functions are divided into modules. The player module is used to interact with the game world. This is why we need to "import" the player module to use its functions.

Functions are executed by writing the word "player" and then a dot, followed by the function name and parentheses.

Functions are executed one by one, from top to bottom - meaning that the order is important.

The following functions are available to you:

  • To move forward, you need to type player.move_forward().
  • To turn left, you need to type player.turn_left().
  • To turn right, you need to type player.turn_right().

The white X mark displayed after you first move represents your start position, the star at the end of the path represents your end goal.

Once you finished writing your code, press the "Run" button to execute all commands one by one.

Try it out!

Code book