Escape Room Program – Part 1: input and output

Step 5 – Getting fancy with the name

Code helper imageIt's all very well printing the name out, but it would be better if we could put it in a nice message.

This is a little bit trickier, so take care.

  1. Change your  print(player) code to read:  print("Hello brave " + player)
  2. Run your code to check what happens

    The + symbol lets us link the "Hello brave" text with the variable. This is called concatenation

  3. Now change the code to try this:  print("Hello brave " + player + ". Welcome to the Escape Room.")
  4. Run your program again to check it works

    Watch the quotes ("), brackets and spaces carefully with this code.

You can use the + to concactenate like this with most variables, although it gets a little trickier when the variables are numbers.

Now do: What else could you add to your greeting for the player? Can you make the greeting match the theme of the escape room?