

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
No active XP Potion
Accept a Quest
Login to submit answers
Back
ctrl+,
Next
ctrl+.
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's 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.Focus Editor
Alt+Shift+]
Next Tab
Alt+Shift+[
Become a member to Submit
Become a member to Run
Become a member to view solution