Only Real Integers

Mixed lists can contain numbers, strings, and other values, but sometimes you only need the true integers. Write a function filter_list that takes a list lst and returns a new list containing only elements of type int. Keep the original order of the numbers, and exclude boolean values.

Примеры

Ввод
[1, 2, "a", "b"]
Вывод
[1, 2]
Ввод
[1, "a", "b", 0, 15]
Вывод
[1, 0, 15]
Ввод
[1, 2, "aasf", "1", "123", 123]
Вывод
[1, 2, 123]

Нужно реализовать

def filter_list(lst: list) -> list:

Теги

listsarray
PostgreSQLv16

Aici va apărea rezultatul execuției codului

Visible tests
1
Input
[1,2,"a","b"]
Expected[1,2]
2
Input
[1,"a","b",0,15]
Expected[1,0,15]
3
Input
[1,2,"aasf","1","123",123]
Expected[1,2,123]
4
Input
[]
Expected[]
5
Input
["x","y","z"]
Expected[]
6
Input
["b","a",2,1]
Expected[2,1]
Focus radio
Paused · SomaFM · Fluid