Advertisement
Seikavx

Input verification dubwhile

Nov 29th, 2022 (edited)
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. """Input Verification Yes/No dubwhile, revised/modified by Raven Scott 11/30/2022"""
  2. """Original Author: Juan Martinez, "short boolean script" source: stack, 2/05/2019"""
  3.  
  4. yesNo = False
  5. while not yesNo:
  6.     something = input("Enter something: ")
  7.     yesNo = input(f"If {something} is true: Enter y/n: ")      
  8.     if yesNo.casefold() == 'y':
  9.         break
  10.     if yesNo.casefold() == 'n':
  11.         yesNo = False
  12.     else:
  13.         noYes = False
  14.         while not noYes:
  15.             yesNo = input("Please enter y/n:")
  16.             if yesNo.casefold() == 'y':
  17.                 noYes = True
  18.             if yesNo.casefold() == 'n':
  19.                 noYes = False
  20.                 yesNo = False
  21.                 break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement