0

It's easy but I can't remember

Hi, I can't remember an easy thing, how could I do like this: a = [1,2,3,4,5] if " An element of the array a" == 3: ....

24th Nov 2018, 1:03 PM
Bobur Ochilov
Bobur Ochilov - avatar
17 Réponses
+ 1
for x in [1,2,3,4,5]: if x == 3: return True
24th Nov 2018, 1:59 PM
Etabeta1🇮🇹
Etabeta1🇮🇹 - avatar
+ 1
Thank you bro, that's exactly what I was looking for!
24th Nov 2018, 2:00 PM
Bobur Ochilov
Bobur Ochilov - avatar
0
if 3 in a: ...
24th Nov 2018, 1:30 PM
Etabeta1🇮🇹
Etabeta1🇮🇹 - avatar
0
No, I need exactly as I have shown, I don't know what to put instead of "An element..."
24th Nov 2018, 1:51 PM
Bobur Ochilov
Bobur Ochilov - avatar
0
Do you mean if a contains 3?
24th Nov 2018, 1:54 PM
Etabeta1🇮🇹
Etabeta1🇮🇹 - avatar
0
yep
24th Nov 2018, 1:55 PM
Bobur Ochilov
Bobur Ochilov - avatar
0
Try what i wrote, it works
24th Nov 2018, 1:56 PM
Etabeta1🇮🇹
Etabeta1🇮🇹 - avatar
0
Can I write like this?
24th Nov 2018, 1:56 PM
Bobur Ochilov
Bobur Ochilov - avatar
0
"contains"?
24th Nov 2018, 1:56 PM
Bobur Ochilov
Bobur Ochilov - avatar
0
Like what?
24th Nov 2018, 1:56 PM
Etabeta1🇮🇹
Etabeta1🇮🇹 - avatar
0
the word contains
24th Nov 2018, 1:57 PM
Bobur Ochilov
Bobur Ochilov - avatar
0
use in if 3 in a: ....
24th Nov 2018, 1:57 PM
Etabeta1🇮🇹
Etabeta1🇮🇹 - avatar
0
no I can't in my project
24th Nov 2018, 1:57 PM
Bobur Ochilov
Bobur Ochilov - avatar
0
I need the way as I told
24th Nov 2018, 1:58 PM
Bobur Ochilov
Bobur Ochilov - avatar
0
Hmmm...
24th Nov 2018, 2:00 PM
Bobur Ochilov
Bobur Ochilov - avatar
0
Yeees
24th Nov 2018, 2:00 PM
Bobur Ochilov
Bobur Ochilov - avatar
0
Ok
24th Nov 2018, 2:00 PM
Etabeta1🇮🇹
Etabeta1🇮🇹 - avatar