About 187,000 results
Open links in new tab
  1. python - How do I write a loop to repeat the code? - Stack Overflow

    Feb 5, 2021 · Create a function repeat and add your code in it. Then use while True to call it infinitely or for i in range(6) to call it 6 times: import requests def repeat(): addr = input() vendor …

  2. Python – Repeat a element in a List | GeeksforGeeks

    Dec 18, 2024 · In this article, there are various methods to Repeat an element in a List. * operator allows us to repeat an entire list or a list element multiple times, making it the most efficient …

  3. Repetition Statements in Pythion (with Code Examples) - Teachoo

    Dec 13, 2024 · Repetition of a set of statements in a program is made possible using looping constructs. Looping constructs provide the facility to execute a set of statements in a program …

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

    Jan 4, 2025 · repeat () returns an iterator that yields the given object the specified number of times. This is useful for creating sequences with repeated elements without actually storing the …

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

    Oct 25, 2022 · Well, to Repeat in Python refers to repeating a section of code in order to achieve a certain result. In simple terms, it is going over a piece of code a specific number of times. …

  6. How to Repeat Code N Times in Python - Delft Stack

    Feb 14, 2021 · To repeat a block of code N times in Python using a while loop, you can set up a condition based on the variable N and execute the code block until the condition is met. …

  7. Chapter 7: RepetitionPython Textbook - una.pressbooks.pub

    Another common and very powerful repetition structure in Python is the for loop. The for loop will iterate, or repeat, once for each item in a sequence. Each time through the loop, you can …

  8. How To Repeat Code In Python? - Ontechnos

    Nov 1, 2024 · Repeating code in Python can be a necessary task, but it doesn’t have to involve copying and pasting the same block of code multiple times. By leveraging functions, loops, list …

  9. Loops in Python: Exploring the World of Repetition

    Aug 14, 2023 · When it comes to solving problems that involve repetition, loops are our best friends. Python offers two primary loop types: the for loop and the while loop. Each has its own …

  10. Python Repetition Structure - Sansha Academy

    After each processing of the loop body (iteration), the loop’s condition is reevaluated to determine if the instructions should be processed again. It contains four elements: Condition – a boolean …

Refresh