Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

using while loop in python taking input until it matches the desired answer

# take userinput and will keep asking same question
# until gets the desired/set output

i = 'yes'
while True:
    n = str(input('Are we going on a date?: '))
    if n == i:
        print('We are going on a Date')
        break
Comment

PREVIOUS NEXT
Code Example
Python :: encryption python 
Python :: how to check if python is 32 or 64 bit 
Python :: mob psycho 100 
Python :: concat dataframe from list of dataframe 
Python :: discord.py check if message has certain reaction 
Python :: python write list to file 
Python :: word pattern python 
Python :: install python packages from inside within python program 
Python :: install lz4 python 3 
Python :: python limit float to 2 decimal places 
Python :: how to create a role and give it to the author discord.py 
Python :: bar plot matplotlib 
Python :: array length godot 
Python :: How to install XGBoost package in python on Windows 
Python :: how to read a text file from url in python 
Python :: pathlib path get directory of current file 
Python :: install sklearn-features 
Python :: flask get ip of user 
Python :: python trie 
Python :: python regex cheat sheet 
Python :: django rest framework 
Python :: python script header 
Python :: import image 
Python :: how to round a number down in python 
Python :: python reverse array 
Python :: how to close a webpage using selenium driver python 
Python :: seaborn correlation 
Python :: import django-on-heroku 
Python :: decorator python 
Python :: transform categorical variables python 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =