O
O
Onervi2021-06-13 19:05:44
Python
Onervi, 2021-06-13 19:05:44

How to make if reread the entire array?

The essence of the question is to check the array not through for

Example:
As it should be

massiv = [10,20,30,40]
if(40 == massiv):
    print('work')

How do I know and how does not suit me
massiv = [10,20,30,40]
for i in massiv:
    if(i == 40):
        print('work')

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Yakushenko, 2021-06-13
@Onervi

if 40 in massiv:
    ....

R
Ronald McDonald, 2021-06-13
@Zoominger

foreach

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question