About 40,100,000 results
Open links in new tab
  1. How to ask user 'Do You Want To Continue?' in python using …

    Jan 17, 2022 · You can use input within the while statement condition check. Something like this: while input("Do You Want To Continue? [y/n]") == "y": # do something print("doing something")

  2. Add yes/no confirmation in python 3.X - Stack Overflow

    I would like to add a confirmation step that will allow them to answer yes or no to continue. If they select no it should allow them to restart the function of adding data to the list. I also want to make sure they answer with Y, YES, y, yes, N, NO, n, no.

  3. I want to have a yes/no loop in my code, but I'm having trouble …

    I would do it the following way: while True: # your code cont = raw_input("Another one? yes/no > ") while cont.lower() not in ("yes","no"): cont = raw_input("Another one? yes/no > ") if cont == "no": break If you use Python3 change raw_input to input.

  4. Asking to Quit or play again? Yes or No? : r/learnpython - Reddit

    You can do this: have a variable, for example, named quit = False. Then have a while loop that asks if the player wants to continue (same idea like you did with the rock/paper/scissors input). Then, if he says "yes" -> quit = True and break. If no -> just break. Else say something like "spelling!" and it will just continue.

  5. While loop Yes or No Python | Example code - EyeHunts

    Dec 9, 2021 · Use while true with if statement and break statement to create a While loop yes or no in Python. Simple if while condition equal to “N” then wait for the user input of Y before exiting. The basic syntax of a while loop in Python is as follows: while condition: # Code block to be executed while the condition is True # ...

  6. Yes/No question with user input in Python | bobbyhadz

    Apr 9, 2024 · To create a yes/no while loop with user input: Use a while loop to iterate until a condition is met. Use the input() function to get input from the user. If the user types no, use the break statement to break out of the loop.

  7. How to Take Continuous Input in Python? - Python Guides

    Jun 18, 2023 · The continue statement is used to end the present iteration and continue with the next iteration. Example: while True: try: age = int(input("Enter age: ")) if age<=20: print("The age is correct") break; else: print("The age is not correct") except ValueError: print("Invalid") continue

  8. Python Continue Statement - GeeksforGeeks

    Mar 11, 2025 · We should use the continue statement when we need to control the flow of loops efficiently by skipping specific iterations while still executing the rest of the loop. Here are some key scenarios: Skipping Specific Values: When certain values should be ignored while continuing with the remaining iterations.

  9. Python Break and Python Continue – How to Skip to the Next …

    Mar 14, 2022 · If you ever need to skip part of the current loop you are in or break out of the loop completely, then you can use the break and continue statements. In this article, I will cover how to use the break and continue statements in your Python code.

  10. while loop in python for do you want to continue - IQCode

    Feb 2, 2022 · while input("Do You Want To Continue? [y/n]") == "y": # do something print("doing something") View another examples Add Own solution

  11. Some results have been removed
Refresh