An If Statement is a piece of code that tells your program to do a group of commands if something is true.

  • Go to and drag out If.
  • Go to and drag out Set Text. Drop it inside the if statement.

To put something inside of an if statement, it should be right below the line that starts with if.

It should be indented four spaces. If there is a yellow block ···· to the left of your code, your spacing is correct!

To navigate the page using the TAB key, first press ESC to exit the code editor.

stage.set_background("schoolentrance") sprite = codesters.Sprite("person10") sprite.go_to(-125, -100) emma = codesters.Sprite("person8") emma.move_down(125) emma.say("Someone took my phone!") stage.wait(2) emma.say("They've been sending people mean texts pretending to be me!") stage.wait(2) sprite.say("What should I do?") stage.wait(2) choice = sprite.ask("a) tell a trusted adult b) tell people Emma is sending the messages c) ignore Emma") # text = codesters.Text("text", x, y) text = codesters.Text("Hello up here.", 0, 200)
  • Run Code
  • Enviar Trabajo
  • Actividad Siguiente
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)