PYTHON Study Guide - String Interpolation, Dollar Sign
Document Summary
8. 2 - "groceries" exercise, part i | intro to python. In this exercise, we are provided with a list of dictionaries called products . Each dictionary in products represents a product and has keys for id , name , department , aisle , and price . To access an item in the list, we use square brackets and pass in the index of the item we want to access. Remember that the first item in a list has an index of 0. To access a value in a dictionary, we use square brackets and pass in the key of the value we want to access. We can also use the . keys() method to get a list of all the keys in a dictionary. We can print data in python using the print() function. We can concatenate strings and variables using the + operator or use string interpolation with f-strings.