About 215,000 results
Open links in new tab
  1. Loops in Python – For, While and Nested Loops - GeeksforGeeks

    Mar 8, 2025 · Loops in Python are used to repeat actions efficiently. The main types are For loops (counting through items) and While loops (based on conditions). Additionally, Nested Loops …

  2. How to Repeat N times in Python? (& how to Iterate?) - FavTutor

    Oct 25, 2022 · In this article, we've discussed how to repeat in Python and how it brought up the need for loops and functions. Further, we've learned about repeat() functions in python, …

  3. ForLoop - Python Wiki

    There are two ways to create loops in Python: with the for-loop and the while-loop. for loops are used when you have a block of code which you want to repeat a fixed number of times. The …

  4. Repeat-until or equivalent loop in Python - Stack Overflow

    Dec 15, 2017 · In repeat-until, the condition is evaluated at the end of the loop. So at least one iteration of the loop will always be executed before the end is reached and condition is evaluated.

  5. How to Use the repeat() Function in Python? - Python Guides

    Jan 4, 2025 · Learn how to use Python's `repeat()` function from the `itertools` module! This tutorial covers syntax, examples, and tips for repeating values efficiently in loops.

  6. Python For Loops - W3Schools

    Python For Loops. A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string). This is less like the for keyword in other programming languages, …

  7. python - How do I write a loop to repeat the code? - Stack Overflow

    Feb 5, 2021 · You can create a variable, and then say that as long as the variable is true to its value, to repeat the code in the for loop.

  8. python - How to repeat a for loop - Stack Overflow

    Sep 13, 2015 · Try using a while loop instead: i += 1. if i == 4: i = 0. The same logic can be implemented with: for i in range(4): print(i) Or using the modulo operator which is common …

  9. SOLVED: How to loop n times in Python [10 Easy Examples]

    Jan 9, 2024 · First one is to iterate over the sequence like List, Tuple, Set and Dictionary. And the other one is to iterate over the range of numbers. This version of for loop will iterate over a …

  10. Easily Repeat Tasks Using Loops - OpenClassrooms

    Loops let you easily repeat tasks or execute code over every element in a list. A for loop enables you to repeat code a certain amount of time. A while loop lets you repeat code until a certain …

  11. Some results have been removed
Refresh