About 5,640,000 results
Open links in new tab
  1. Loop Through a List using While Loop in Python - GeeksforGeeks

    Feb 7, 2024 · When it comes to looping through a list, the while loop can be a handy alternative to the more commonly used for loop. In this article, we'll explore four simple examples of how to …

  2. Iterate over a list in Python - GeeksforGeeks

    Jan 2, 2025 · Here we are using a while loop to iterate through a list. We first need to find the length of list using len (), then start at index 0 and access each item by its index then …

  3. Python - Loop Lists - W3Schools

    You can loop through the list items by using a while loop. Use the len() function to determine the length of the list, then start at 0 and loop your way through the list items by referring to their …

  4. Python List - Loop through Items - For, While, Enumerate

    Python List Loop through Items - You can loop through the list of items in python using for loop, while loop or enumerate. We will go through each of them and their variations with examples.

  5. Python List While Loop

    Python List While Loop. Python List is a collection of items. While loop can be used to execute a set of statements for each of the element in the list. In this tutorial, we will learn how to use …

  6. python - how to use while loop whilst checking items in a list

    Oct 17, 2015 · def occupants(): oc = [] while len(oc) < 7: x = int(input("Enter a number")) oc.append(x) print oc You loop will run until the length of "oc" is 6 and at "len(oc)=6" it will …

  7. 13 Ways to Loop Through a List in Python [Examples Included]

    Jun 21, 2021 · A well-coded loop through a list in Python will allow you to create complex calculators and input-dependent programs that save you time and effort while dramatically …

  8. How to Iterate Through a List Using While Loop in Python

    In Python, we can iterate through a list using a while loop by maintaining an index variable that helps access each element one by one until we reach the end of the list. The loop continues …

  9. How to Iterate (Loop) Over a List in Python - datagy

    Apr 29, 2022 · One of the simplest ways to loop over a list in Python is by using a for loop. A for loop allows you to iterate over an interable object (like a list) and perform a given action. This …

  10. How to Iterate Through a List in Python? - Python Guides

    Sep 20, 2024 · To iterate through a list in Python, the most straightforward method is using a for loop. The syntax is simple: for item in list_name:, where item represents each element in the …

Refresh