+ 3
Please how can I check an array in python
That's, I want to verify if a certain value in my array of integers is greater than 16!
6 Réponses
+ 6
Jan Markus' second answer should be what you need. It can be shortened:
test = any(i > 16 for i in arr)
You could also use max:
test = max(arr) > 16
Any is the better solution though
+ 2
Thanks very much guys(am new to python)
I just did it but had to test for i<16 and print "no way" if true else "let's go" if false.
the other way round will not always work.
Thnks tho
+ 1
My real problem is like:
The user inputs 3 integers as an array and you have to check If any value is greater than 16.
+ 1
😑😑😑 sorry but it doesn't solve the problem!
+ 1
It should print say "let's go" if at least 16 and "no way" if less than 16.
So the user inputs 3 values in an array and the code checks..... that's what am trying to do🙏
+ 1
Ok thnks