write a For loop that iterates through a list of products (any number of products) that are sold in a store and prints them. [examples: fan, fridge, freezer, washer, etc.]. b) copy the code from a) and use the same loop to add more products(any)to the list. You must use list methods to add. c) Copy the code from c), and search for a specific product (any), if the product is found the loop is terminated. Make sure to use else in the for loop. d) Create an empty dictionary, then add 4 entries (the key is a word, the value is word’s frequency in a book). [example: {‘street’: 23}]. e) Create a for loop to access the entries from d) and print the keys and values. f) Copy the code from e) and search for a specific key in the dictionary and prints its value. The program prints a message “ the {key} is not found”, if the key does not exist. ..?
Code the following
write a For loop that iterates through a list of products (any number of products) that are sold in a store and prints them. [examples: fan, fridge, freezer, washer, etc.].
b) copy the code from a) and use the same loop to add more products(any)to the list. You must use list methods to add.
c) Copy the code from c), and search for a specific product (any), if the product is found the loop is terminated. Make sure to use else in the for loop.
d) Create an empty dictionary, then add 4 entries (the key is a word, the value is word’s frequency in a book). [example: {‘street’: 23}].
e) Create a for loop to access the entries from d) and print the keys and values.
f) Copy the code from e) and search for a specific key in the dictionary and prints its value. The program prints a message “ the {key} is not found”, if the key does not exist. ..?
Step by step
Solved in 3 steps