

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
Not enough gems
Cost: 6 gems
1: Number Sum
incomplete
2: Find Min
incomplete
3: Remove Non-Integers
incomplete
4: Factorial
incomplete
5: Area Sum
incomplete
6: List Division
incomplete
7: Join Strings
incomplete
8: Unit Tests
incomplete
9: Fix a Failing Test
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
The built-in type() function can be used to get the type of a variable. For example:
type(1) is int
# True
type("1") is str
# True
type(1.0) == float
# True
type("seventy-six") == int
# False
Complete the remove_nonints() function. It takes a list and returns a new list but with all the non-integer types removed.
new_list: list[int] = remove_nonints(["1", 1, "3", "400", 4, 500])
print(new_list)
# [1, 4, 500]
Do not change the input nums list. Return a new list with only the integers.