How to identify list element? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to identify list element?

lst=[el1,el2,el3,el4] # How i can identify any type elements without indexing and slicing? Can i use if,else statement or loop for a list?

6th May 2020, 10:18 AM
Abidur Rahman
Abidur Rahman - avatar
3 Answers
+ 3
You mean ? For i in lst If i=="el1": Do something Elif i=="el2": Do.....
6th May 2020, 10:22 AM
Abhay
Abhay - avatar
+ 1
Input=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] Create a list output of the prime numbers of the input list using loop, and if,else statements?
6th May 2020, 11:08 AM
Abidur Rahman
Abidur Rahman - avatar
0
Try this for i in lst: do something ....
6th May 2020, 10:22 AM
estifanos
estifanos - avatar