topskill.dev
CoursesTracks
0
All courses/Python Basics: The Lantern AtlasDemo: Name a Map Location
Level 1: Spawn Camp — First Steps
5 / 11
← Python Basics: The Lantern Atlas
○Level 1: Spawn Camp○Demo: Light the Camp Message○Exercise: Open the Lantern Map○Code Comments●Demo: Name a Map Location○Exercise: Label a Beacon○Variable Types○Demo: Inspect Lantern Types○Exercise: Pack Starting Supplies○Optional: Set up Python Locally✦Module Quiz
○Demo: Divide Beacon Shards○Exercise: Price a Cache Route○Demo: Format a Gear Label○Exercise: Format Forge Readouts○Demo: Convert Shard Text○Exercise: Convert Charge Readings○Demo: Read a Pathfinder Name○Project: Build Adi’s Gear HUD✦Module Quiz
○Demo: Compare Workshop Supplies○Exercise: Check Gate Supplies○Demo: Choose a Lit Route○Choose a Gate Signal○Demo: Pulse a Beacon with while○Exercise: Recharge the Beacon○Demo: Mark a Route with range○Exercise: Label Even Patrols○Demo: Skip a Hazard, Stop at a Gate○Exercise: Cross Safe Tiles○Project: Unlock the Exit Gate✦Module Quiz
○Define a Beacon Ability: Demo○Exercise: Activate a Beacon○Pass Energy and Return a Result: Demo○Exercise: Combine Beacon Energy○Default Ability Marks: Demo○Exercise: Name a Beacon Ability○Local Energy Scope: Demo○Exercise: Spend Local Energy○Project: Build an Ability Loadout✦Module Quiz
○Read a Rune Code: Demo○Exercise: Read Rune Edges○Slice a Cavern Route: Demo○Exercise: Decode Route Fields○Clean a Rune Message: Demo○Exercise: Decode a Rune Notice○Format a Route Card: Demo○Exercise: Write a Decoded Route Sign✦Module Quiz
○Index a Gear List: Demo○Exercise: Build a Gear Queue○Change a Gear List: Demo○Exercise: Repair the Loadout○Slice a Ridge Route: Demo○Exercise: Pack for Checkpoints○Read a Fixed Checkpoint Record: Demo○Exercise: Read an Exit Checkpoint✦Module Quiz
○Read an Atlas Map Card○Exercise: Update a Map Entry○Loop Through Beacon Map Entries○Exercise: Count Cache Marks○Count Unique Atlas Stops○Exercise: Compare Atlas Routes○Demo: Summarize Beacon Finds○Exercise: Build the Atlas Treasure Index✦Module Quiz
○Recover a Faded Beacon Reading○Exercise: Label Beacon Charge○Demo: Write a Shrine Save○Exercise: Save a Beacon Signal○Mini Project: Restore the Save Shrine✦Module Quiz
○Demo: Calculate Beacon Capacity○Exercise: Calculate Lantern Capacity○Demo: Import a Local Beacon Rule○Exercise: Import a Shrine Rule○Demo: Follow a Dotted Package Import○Exercise: Read an Atlas Record✦Module Quiz
○Echo Tower: The Base Case○Echo Tower: Sum the Signals○Echo Tower: Tune the Frequencies○Echo Tower: Select Beacon Labels✦Module Quiz
○Exit Gate: Reading Object Vocabulary○Final Game Mission: Open the Exit Gate✦Module Quiz

Demo: Name a Map Location

Programs need to remember information. A calculator needs its input numbers and result; a map needs the name of the current location. A variable gives a value a name so you can use it again.

The assignment room = "Spawn Camp" makes the name room refer to the string "Spawn Camp". In the diagram, the name and value are separate: the arrow shows the reference between them.

A name refers to a value

To display the value, pass the variable name to print() without quotes:

python
room = "Spawn Camp"
print(room)

Run the example. It prints Spawn Camp, not room. Writing print("room") would print the word itself.

Choose a useful name

Names are case-sensitive: room, Room, and ROOM are different names. A name cannot start with a digit or contain spaces. For names with several words, Python programmers usually use snake_case, such as current_room.

Short names like these give a reader little help:

python
a = "Good morning"
n = "Eddie"

The following names explain the values. Run the example to see that print() can display two values, separated by a space.

python
greeting = "Good morning"
name = "Eddie"
print(greeting, name)

You may hear the terms defining and initializing a variable. The first assignment introduces the name and gives it an initial value in one step. A later assignment can make that same name refer to a different value.

In main.py, the print call is already supplied. Leave it in place and change the location assignment. Press Run to see Beacon Ridge, then Submit.

Your Task

  1. Set room to "Beacon Ridge".
Files
  • ⋄main.py
Loading editor…
Press Run to execute your code.