How get the items that are int data type form the list of different data type in the list?

For a given list, x = [21, ‘hello,’cream’, 20,19,’village’], using for loop to iterate over the items and using - if statement print the items that are of type int

@souravkrsheel99

for i in range(len(sequence)):
element = sequence[i]
if type(element) == int:
print(element)

Try this code , see if it works.

no maam I did not get the answer it showing error

@souravkrsheel99

Take the screenshot of the error in the ide and paste code and error both.