How to find input present in list or not @ python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to find input present in list or not @ python

let I gave input 20, and list [1-100], now what to do to find whether 20 present in list or not. how to code and what to use

4th Sep 2018, 5:31 AM
Ekkuluri Audityavarthan
Ekkuluri Audityavarthan - avatar
1 Answer
+ 2
Use 'in' operator, here's an example: l = list(range(1, 101)) # make list 1-100 print(20 in l) print( 50 in l) print(l)
4th Sep 2018, 6:04 AM
Ipang