Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I make it so my code can return to a line if the User says No

textinfo = str(input("Insert Text here:"))
LocateInText = str(input("Insert What needs to be found (i.e words, numbers, ect):"))
Confrim = str(input("Are you sure? This may take a bit, Y or N:"))

if Confrim == "N":
    find: LocateInText

I am trying to make it so that when the user says N (no) It repeats LocateInText to correct themselves

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

If the textinfo does not need to be edited you can add the LocateInText and Confirm into a while loop and break it when user confirms it.

textinfo = str(input("Insert Text here:"))
while True:
    LocateInText = str(input("Insert What needs to be found"))
    Confrim = str(input("Are you sure? This may take a bit, Y or N:"))
    if Confirm == 'Y':
        break
# do next thing here
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading