Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a named list with elements 'a' and 'b'.
R Programming
my_list <- list([1] = 1, b = 2)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a value instead of a name for the list element.
Using an incorrect name like 'c' or 'x'.
✗ Incorrect
The name of the first element in the list should be 'a'.
2fill in blank
mediumComplete the code to access the element named 'score' from the list.
R Programming
value <- my_list$[1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using numeric indices instead of names.
Using quotes inside the $ operator.
✗ Incorrect
Use the $ operator with the element name 'score' to access it.
3fill in blank
hardFix the error in naming the list element correctly.
R Programming
my_list <- list([1] = 10, b = 20)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number as a name.
Confusing element names with values.
✗ Incorrect
The element name must be a valid name like 'score', not a value like 10.
4fill in blank
hardFill both blanks to create a named list with elements 'name' and 'age'.
R Programming
person <- list([1] = "Alice", [2] = 30)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect names like 'gender' or 'height'.
Swapping the order of names and values.
✗ Incorrect
The list should have elements named 'name' and 'age' with corresponding values.
5fill in blank
hardFill all three blanks to create a named list with elements 'x', 'y', and 'z'.
R Programming
coords <- list([1] = 10, [2] = 20, [3] = 30)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong name like 'w'.
Mixing up the order of names.
✗ Incorrect
The list elements should be named 'x', 'y', and 'z' with their respective values.