About 124,000 results
Open links in new tab
  1. python - How can I access the index value in a 'for' loop ... - Stack ...

    Tested on Python 3.12 Here are twelve examples of how you can access the indices with their corresponding array's elements using for loops, while loops and some looping functions.

  2. python - Iterating through array - Stack Overflow

    Oct 31, 2015 · 4 If you want to stay with a for-loop (e.g. because you want to mutate the existing array instead of creating a new one), you should simplify the code. I would first simplify the …

  3. How to iterate through a list of dictionaries - Stack Overflow

    1 There are multiple ways to iterate through a list of dictionaries. However, if you are into Pythonic code, consider the following ways, but first, let's use instead of because in Python snake_case …

  4. Iterating through a multidimensional array in Python

    Jun 9, 2009 · I have created a multidimensional array in Python like this: self.cells = np.empty((r,c),dtype=np.object) Now I want to iterate through all elements of my …

  5. Python 'For' Loop Iterate Array - Stack Overflow

    I am new to python and I am looking for some help with loop structures, specifically how to use a 'For' loop or alternative loop to solve a problem. I need to figure a discounted price based on …

  6. Numpy how to iterate over columns of array? - Stack Overflow

    Suppose I have and m x n array. I want to pass each column of this array to a function to perform some operation on the entire column. How do I iterate over the columns of the array? For …

  7. Assign values to array during loop - Python - Stack Overflow

    Feb 19, 2017 · I would like to write a loop in Python, where the size of the array increases with every iteration (i.e., I can assign a newly calculated value to a different index of a variable). For …

  8. How to modify list entries during for loop? - Stack Overflow

    Sep 8, 2023 · I know that it is not safe to modify the list during an iterative looping. However, suppose I have a list of strings, and I want to strip the strings themselves. Does replacement …

  9. Iterating over a 2 dimensional python list - Stack Overflow

    May 14, 2013 · '0,0' '1,0' '2,0' '0,1' '1,1' '2,1' that is iterate through 1st column then 2nd column and so on. How do i do it with a loop ? This Question pertains to pure python list while the question …

  10. Iterating through a for loop with the size of an array

    Dec 10, 2022 · 0 Create Array with input number (Eg. arr = [12, 15, 4] ) Iterate over the created Array In for loop check if number are divisible by 3 and 5 Sample code: