You may want to consider using a different type of loop where that logic is applicable, because it is the most obvious answer.
perhaps a:
i=2 while i < n: if something: do something i += 1 else: do something else i = 2 #restart the loop
Related Posts:
- Python – TypeError: ‘int’ object is not iterable
- Why there is no do while loop in python
- Python – TypeError: ‘int’ object is not iterable
- Accessing the index in ‘for’ loops?
- How to avoid “RuntimeError: dictionary changed size during iteration” error?
- How to avoid “RuntimeError: dictionary changed size during iteration” error?
- Pythonic way to combine FOR loop and IF statement
- Subplot for seaborn boxplot
- Exit while loop in Python
- Pythonic way to iterate through a range starting at 1
- Loop backwards using indices in Python?
- Why does using from __future__ import print_function breaks Python2-style print?
- Breaking out of nested loops
- Is there a “do … until” in Python?
- Iterating over a 2 dimensional python list [duplicate]
- Infinite for loops possible in Python?
- Python loop counter in a for loop
- Get a Try statement to loop around until correct value obtained
- Python: Continuing to next iteration in outer loop
- SyntaxError: unexpected EOF while parsing
- Why am I seeing “TypeError: string indices must be integers”?
- TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array
- How to emulate a do-while loop?
- How to prettyprint a JSON file?
- How to install pip with Python 3?
- pip not recognised as an internal or external command
- Converting list to numpy array
- How do I parse a string to a float or int?
- Check if something is (not) in a list in Python
- How to parse data in JSON format?
- TypeError: unhashable type: ‘dict’
- ‘Conda’ is not recognized as internal or external command
- Python list of dictionaries search
- Extract file name from path, no matter what the os/path format
- Importing requests module does not work
- Converting string into datetime
- How do I read CSV data into a record array in NumPy?
- How to normalize a NumPy array to a unit vector?
- Local variable referenced before assignment?
- Clickable link inside message discord.py
- Is arr.__len__() the preferred way to get the length of an array in Python?
- Running Python from Atom
- TypeError: can’t use a string pattern on a bytes-like object in re.findall()
- inserting characters at the start and end of a string
- Python: SyntaxError: keyword can’t be an expression
- “ImportError: no module named ‘requests'” after installing with pip
- Append integer to beginning of list in Python
- Most efficient way to map function over numpy array
- List comprehension on a nested list?
- Running Selenium with Headless Chrome Webdriver
- boto3 client NoRegionError: You must specify a region error only sometimes
- Converting Dictionary to List?
- pip3: command not found
- How to get keyboard input in pygame?
- How to use sys.exit() in Python
- How do I get an empty array of any size in python?
- How to deep copy a list?
- How to remove \n from a list element?
- How to add an empty column to a dataframe?
- Virtualenv Command Not Found
- TypeError: ‘float’ object has no attribute ‘__getitem__’,python
- How to apply a function to two columns of Pandas dataframe
- Get Confusion Matrix From a Keras Multiclass Model
- AttributeError: ‘list’ object has no attribute ‘lower’ gensim
- Insert a row to pandas dataframe
- Anaconda Installed but Cannot Launch Navigator
- How to save a Seaborn plot into a file
- How to get the unit vector from a numpy array
- Subtract two columns in dataframe
- Sending string via socket (python)
- pandas DataFrame: replace nan values with average of columns
- How do I print the key-value pairs of a dictionary in python
- How to make a set of lists
- What’s the difference between a Python module and a Python package?
- Truncate to three decimals in Python
- RSA encryption and decryption in Python
- pip3 error – ‘_NamespacePath’ object has no attribute ‘sort’
- What does {0} mean in this Python string?
- Tab Error in Python
- Installation of pygame with Anaconda
- Is there a Python equivalent of the C# null-coalescing operator?
- Python 3.6 import requests
- Tensorflow 2.0 – AttributeError: module ‘tensorflow’ has no attribute ‘Session’
- What is key=lambda
- Extract a part of the filepath (a directory) in Python
- Python 3.5.1 urllib has no attribute request
- Rotating a two-dimensional array in Python
- TypeError: sequence item 0: expected string, int found
- What is the meaning of “int(a[::-1])” in Python?
- Pandas unstack problems: ValueError: Index contains duplicate entries, cannot reshape
- How do I read image data from a URL in Python?
- Python: Convert timedelta to int in a dataframe
- Can’t concat bytes to str
- cmake error ‘the source does not appear to contain CMakeLists.txt’
- ubuntu /usr/bin/env: python: No such file or directory
- Invalid syntax when using “print”?
- Error loading MySQLdb module: No module named ‘MySQLdb’
- Unable to install boto3
- Python MySQLdb not importing
- Write a program that asks the user to enter five test scores. Correspond it to a letter grade