How to count the integers in list with strings and numbers using Python

1 Answer

0 votes
lst = [2, 99, "java", 34, "php", 7, "python", "c", 89] 

total = len(list(i for i in lst if isinstance(i, int))) 
 
print(total)
  
       
      
'''
run:
 
5
      
'''

 



answered Apr 14, 2020 by avibootz

Related questions

1 answer 204 views
1 answer 145 views
2 answers 205 views
1 answer 150 views
...