Questions for Cognitive Load Experiment - B¶
Finish the function has22
below to return True
if there are at least two items in the list nums
that are adjacent and both equal to 2, otherwise return False
. For example, return True
for has22([1, 2, 2])
since there are two adjacent items equal to 2 (at index 1 and 2) and False
for has22([2, 1, 2])
since the 2’s are not adjacent.
-
In solving the preceding problem I invested:
- 1. Very, very low mental effort
- 2. Very low mental effort
- 3. Low mental effort
- 4. Rather low mental effort
- 5. Neither low nor high mental effort
- 6. Rather high mental effort
- 7. High mental effort
- 8. Very high mental effort
- 9. Very, very high mental effort
Put the code in order to define countInRange
that returns a count of the number of times that a target
value appears in a list between the start
and end
indices (inclusive). For example, countInRange(1,2,4,[1, 2, 1, 1, 1, 1])
should return 3
since there are three 1’s between index 2 and 4 inclusive.
-
In solving the preceding problem I invested:
- 1. Very, very low mental effort
- 2. Very low mental effort
- 3. Low mental effort
- 4. Rather low mental effort
- 5. Neither low nor high mental effort
- 6. Rather high mental effort
- 7. High mental effort
- 8. Very high mental effort
- 9. Very, very high mental effort
Finish the function diffMaxMin
to return the difference between the largest and smallest value in the passed list of numbers (nums
). For example, diffMaxMin([1,2,3])
should return 2 since the difference between 3 and 1 is 2.
-
In solving the preceding problem I invested:
- 1. Very, very low mental effort
- 2. Very low mental effort
- 3. Low mental effort
- 4. Rather low mental effort
- 5. Neither low nor high mental effort
- 6. Rather high mental effort
- 7. High mental effort
- 8. Very high mental effort
- 9. Very, very high mental effort
Put the code in order to define total_values
that takes a dictionary (dict
) and returns the total of the values in the dictionary. For example, total_values({'red': 3, 'blue': 2, 'green': 20})
would return 25
.
-
In solving the preceding problem I invested:
- 1. Very, very low mental effort
- 2. Very low mental effort
- 3. Low mental effort
- 4. Rather low mental effort
- 5. Neither low nor high mental effort
- 6. Rather high mental effort
- 7. High mental effort
- 8. Very high mental effort
- 9. Very, very high mental effort
Finish the function get_names
that takes a list of dictionaries and returns a list of strings with the names from the dictionaries. The key for the first name is ‘first’ and the key for the last name is ‘last’. Return a list of the full names (first last) as a string. If the ‘first’ or ‘last’ key is missing in the dictionary use ‘Unknown’. For example, [{'first': 'Ann', 'last': 'Brown'}, {'first': 'Darius'}]
should return ['Ann Brown', 'Darius Unknown']
..
-
In solving the preceding problem I invested:
- 1. Very, very low mental effort
- 2. Very low mental effort
- 3. Low mental effort
- 4. Rather low mental effort
- 5. Neither low nor high mental effort
- 6. Rather high mental effort
- 7. High mental effort
- 8. Very high mental effort
- 9. Very, very high mental effort