Today I'll talking about dictionaries ,
nicknamed affectionately dics!
with keys and values...
user={ "name":"Natália", "age":27, "city":"fortaleza" } GetAge=user.get("age") print(user) user.pop("age") print(user) user["age"]=28 print(user)
Our keys:"name","age" and "city"
with values:"Natália",27 and "fortaleza"
with .get() method we get the key of our dic that take us for get the especific value,and .pop() where we put a new "key":"value" on our code.
GetAge=user.get("age") user.pop("age")
and with a new value we can make something like:
user["age"]=28
Thanks for reading!
Top comments (0)