Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a range from 1 to 5.
Kotlin
val numbers = 1 [1] 5
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '...' which is not a valid range operator in Kotlin.
Using 'until' which excludes the end value.
✗ Incorrect
The .. operator creates a range including both start and end values.
2fill in blank
mediumComplete the code to check if 3 is inside the range from 1 to 5.
Kotlin
val isInRange = 3 [1] 1..5
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' which checks equality, not membership.
Using 'not in' which checks the opposite.
✗ Incorrect
The in operator checks if a value is inside a range.
3fill in blank
hardFix the error in the code to check if 10 is not in the range from 1 to 5.
Kotlin
val check = 10 [1] 1..5
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'in' which checks if the value is inside.
Using '!=' which checks inequality, not range membership.
✗ Incorrect
The not in operator checks if a value is outside the range.
4fill in blank
hardFill both blanks to create a range from 5 to 10 and check if 7 is inside it.
Kotlin
val range = [1] [2] 10 val result = 7 in range
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'until' which excludes the end value.
Using 'to' which creates a Pair, not a range.
✗ Incorrect
Use 5 as the start and .. to create an inclusive range to 10.
5fill in blank
hardFill all three blanks to create a range from 'a' to 'z' and check if 'm' is inside it.
Kotlin
val letters = [1] [2] [3] val containsM = 'm' in letters
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'until' which excludes the end character.
Using double quotes instead of single quotes for characters.
✗ Incorrect
Use 'a' as start, .. as range operator, and 'z' as end.