Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Build letter E | Challenges
Python Ninja

book
Challenge: Build letter E

Welcome to the "Build Letter E" challenge!

Let's recap the ninja methods and features you've learned:

Ninja Methods:

  • go_right(), go_left(), go_up(), go_down(): Move the ninja one cell in the specified direction.
  • pick_sushi(): Pick up sushi from the map and add it to your inventory.
  • put_sushi(): Place sushi from your inventory onto a cell.
  • object_up(), object_down(), object_right(), object_left(): Determine the object in the next cell in the specified direction, returning "wall", "sushi", or "empty".

Programming Concepts:

  • Functions: Create reusable blocks of code to perform specific tasks.
  • Decomposition: Break down complex problems into smaller, manageable parts.
  • Loops: Use for and while loops to repeat actions.
  • Conditional Statements: Use if-else statements to make decisions based on conditions.
Task

Swipe to start coding

Solution

def ninja_controller(ninja):
for i in range(3):
move_sushi(ninja)
ninja.go_up()
ninja.go_up()

def move_sushi(ninja):
ninja.go_up()
ninja.go_right()
ninja.pick_sushi()
ninja.go_down()
ninja.go_left()
ninja.put_sushi()

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 6. Chapter 2
py

ninja.py

def ninja_controller(ninja):
pass
# Write your code below
toggle bottom row
We use cookies to make your experience better!
some-alt