Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to get the length of the list.
SASS
$colors: (red, green, blue);
$length: [1]($colors); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
size() which does not exist in Sass.Using
count() which is not a Sass function.Using
length_of() which is invalid.✗ Incorrect
The length() function returns the number of items in a list in Sass.
2fill in blank
mediumComplete the code to get the first item of the list.
SASS
$colors: (red, green, blue);
$first-color: [1]($colors); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
head() which is not a Sass function.Using
start() or begin() which do not exist.✗ Incorrect
The first() function returns the first item in a list in Sass.
3fill in blank
hardFix the error in the code to get the last item of the list.
SASS
$colors: (red, green, blue);
$last-color: [1]($colors); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
end() which is not a Sass function.Using
tail() which does not exist in Sass.✗ Incorrect
The correct function to get the last item in a list in Sass is last().
4fill in blank
hardComplete the code to get a sublist from the second to the third item.
SASS
$colors: (red, green, blue, yellow); $sublist: [1]($colors, 2, 3);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
sublist() which is not a Sass function.Using
list_slice() or segment() which do not exist.✗ Incorrect
The slice() function extracts a part of a list. The start index is 2 and end index is 3 (1-based indexing).
5fill in blank
hardFill all three blanks to join two lists into one.
SASS
$list1: (red, green); $list2: (blue, yellow); $combined: [1]($list1, [2], [3]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
append() which appends a list as a single nested item.Using
$list1 in the second blank which is the original list.Using
space or other separators instead of comma.✗ Incorrect
The join() function adds items from one list to another. The second blank is the list to add, and the third blank is the separator comma.