0
1
2
3
4
for loopfor in range():for x in string:for x in list:for i in range(len(list)): VS. for x in list:
option 1 if you want to mutate the value (need index i)both options if you want to get the valueIt returns a dictionary that maps each negative value in numbers to its frequency in numbers. Use for x in list:
Iterating keys:
Another option: dict.keys():
Iterating values: dict.values():
10
25
27
10
Iterating both keys and values: dict.items()
It returns a list with all the keys and values in the dictionary.
Test cases:
It mutates dict_1, by adding to it all key-values pairs in dict_2. If a key is in both dictionaries, the values are added.
Test cases:
It mutate the list, multiply every number by 2. It returns the highest value in the mutated list.
Test cases:
line 3: can we use for x in list?
line 5: can we use for i in range(len(list))?
Go to gradescope and answer questions:
is the solution correct or not?
line 3: can we use for x in list?