Quick actions

cmd+k|ctrl+k

Navigation

Languages

Dictionary Methods

Snippet info

Language

Python

Visibility

public

Author

edoc26

Created

2026-02-16T12:57:10.450286Z

Updated

2026-02-16T12:57:10.450286Z

# 1 Create a user profile for your new game.
# This user profile will be stored in a dictionary with keys: 'age', 'username', 'weapons', 'is_active' and 'clan'
user_profile = {
    "age": 18,
    "username": "Darrow",
    "weapons": "slingBlade",
    "is_active": True,
    "clan": "Mars"
}

# 2 iterate and print all the keys in the above user.
print(user_profile.keys())

# 3 Add a new weapon to your user
user_profile["weapons"] = "knifeRing"

# 4 Add a new key to include 'is_banned'. Set it to false
user_profile.update({"is_banned": False})

# 5 Ban the user by setting the previous key to True
user_profile["is_banned"] = True

# 6 create a new user2 my copying the previous user and update the age value and username value.
user2_profile = user_profile.copy()
user2_profile.update({"age": 22, "username": "Sevro"})
print(user_profile)
print(user2_profile)


INFO