From the course: Python Data Structures: Dictionaries

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Basic Python dictionary operations and comparators

Basic Python dictionary operations and comparators - Python Tutorial

From the course: Python Data Structures: Dictionaries

Start my 1-month free trial

Basic Python dictionary operations and comparators

- [Instructor] In this video, we will discuss the basic operations that can be done using dictionaries. To change the value of a key in a dictionary, you can use the statement, dictionary name, square brackets, with the key and assign it a new value. The value gets overwritten, that is, if d is the dictionary and the Roman letter two is the key within the square brackets, it gets reassigned the value t-w-o, regardless of whatever was stored previously. The del command can be used to delete an existing key-value pair or the entire dictionary. Even though del has been discussed before, we bring it up here again to discuss it in greater depth. So let's look at this program here. We continue to have sal info dictionary for our teaching purposes. You will see this in this program here, there're five major cities and average software engineer salaries associated as values. We now have in here in line five and six, Atlanta being…

Contents