About 33,600,000 results
Open links in new tab
  1. Python array elements in if statement - Stack Overflow

    Apr 24, 2018 · array = [1,2,3,4,5] for element in array: if element >= 3: print("Yes") else: print("No") Reference: https://wiki.python.org/moin/ForLoop

  2. Python Arrays - W3Schools

    What is an Array? An array is a special variable, which can hold more than one value at a time. If you have a list of items (a list of car names, for example), storing the cars in single variables …

  3. Declaring an Array in Python - GeeksforGeeks

    Sep 26, 2023 · Syntax to Declare an array. Variable_Name - It is the name of an array. typecode - It specifies the type of elements to be stored in an array. [] - Inside square bracket we can …

  4. How to Use Conditional Statements with NumPy Arrays

    Jan 22, 2024 · In this tutorial, we’ll explore various ways to use conditional statements with NumPy arrays. From basic boolean indexing to the more advanced np.where functionality, we …

  5. How to Create Arrays in Python? - Python Guides

    Jan 1, 2025 · Python’s built-in array module provides a way to create arrays of a specific data type. Here’s how you can create an array using the array module: Output: I have executed the …

  6. Can you use if-else statement inside braces for an array in Python ...

    I can do simpler if-statements with a 1D array such as myArray = [otherArray[i] for i in range(theRange) if otherArray[i]>=value and otherArray[i]<=anotherValue] This 1D example is …

  7. Python Arrays - GeeksforGeeks

    Mar 11, 2025 · Array in Python can be created by importing an array module. array ( data_type , value_list ) is used to create array in Python with data type and value list specified in its …

  8. Arrays In Python: The Complete Guide With Practical Examples

    Learn how to use arrays in Python with practical examples using the built-in array module, NumPy arrays, and Python lists. Perfect for data analysis and manipulation.

  9. (Python) How to use conditional statements on every element of array

    Aug 24, 2017 · Python array or numpy array? You can use the all builtin function to accomplish what your asking: Example: Note however that behinds the scenes, all still uses a for loop. It's …

  10. python - Arrays and if statements - Stack Overflow

    Jun 17, 2012 · Change your if -statement to: print "working" and it will work. Your input from the key consists of characters ('0001'), so your comparison has to take that into account. E.g., …

Refresh