A data structure is a way of organizing, managing, and storing data that allows efficient modification and access. Different data structures support different functions more efficiently than others. The data structure represents a group of data values, relationships between the values, and the operations and functions that can be used with the data. An example of how a data structure is used is the use of a b-tree index data structure for retrieving data from a relational database. A hash table data structure is used to look up identifiers.
In this assignment you create three data structure types and populate them with data.
Write a script that sums the values in a list called add_list that contains the following values: (10, 2, -4, 8). Make sure you include a for loop when iterating through the list to sum the values.
Take screenshots of the code and output.
Write a script that prints a dictionary where the key numbers are 1, 2, 3, 4, and 5 and the values are the key number times 2. Be sure to use an appropriate loop to iterate through the dictionary when printing the dictionary.
Take a screenshot of your code and the output.
Imagine you have two grocery lists:
Grocery Lists | |
List A | List B |
Soap | Fish |
Oranges | Pork Loin |
Bananas | Paper Plates |
Oatmeal | Jelly |
Fish | Soap |
Write scripts that do the following:
1.Prints names of products common to both lists.
2.Prints names of products that are in at least one of the two lists.
Take a screenshot of your code and the output.