

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: Dictionaries
incomplete
2: Duplicate Keys
incomplete
3: Accessing Dictionary Values
incomplete
4: Setting Dictionary Values
incomplete
5: Updating Dictionary Values
incomplete
6: Deleting Dictionary Values
incomplete
7: Counting Practice
incomplete
8: Iterating Over a Dictionary in Python
incomplete
9: Ordered or Unordered?
incomplete
10: Quest Status
incomplete
11: Merge Dictionaries
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Dictionaries in Python are used to store data values in key -> value pairs. Dictionaries are a great way to store groups of information.
# use curly braces
# add key-value pairs
car = {
"brand": "Toyota",
"model": "Camry",
"year": 2019,
}
Here the car variable is assigned to a dictionary {} containing the keys brand, model and year. The keys' corresponding values are Toyota, Camry and 2019.
Complete the get_character_record function. It takes a character's name, server, level, and rank as individual inputs, and returns a dictionary with the following string keys:
"name""server""level""rank""id"Next, we can't have two characters named bloodwarrior123 on the same server!
Concatenate the name and the server inputs with a # in the middle. For example, given:
Then the id field would be set to bloodwarrior123#server1.
f-string to create the id field. This is a best practice.