{{tag>projects cloud club computing virtualization machines VMs AWS Azure GCP}}
[[python_club|About the Club]]\\
==== Python Club Topics - Dictionaries ====
==== Dictionary ====
- Often shortened to "dict"
- Multiple values under 1 variable name
- Used to store collections of data
- Data stored in key & value pairs
- Ordered ( starting in Python 3.7 )
- Keys **CANNOT** be duplicated
- Created using curley braces ( eg. { } )
- key pairs **CAN** be changed
==== Dictionary Example ====
- Create a dictionary
my_car = {
"brand": "Ford",
"model": "Focus",
"year": 2010
}
print(my_car)
print("This brand ==> " + my_car["brand"])
- Use the **len()** function
my_car = {
"brand": "Ford",
"model": "Focus",
"year": 2010
}
print(len(my_car))
- Change the value under a key
my_car = {
"brand": "Ford",
"model": "Focus",
"year": 2010
}
my_car['model'] = "Mustang"
print(my_car)