Q:

Python How to make it so entering no input prints you failed to input

How do I make it so my program prints "You failed to input blah blah blah" when I just press enter in the inputs? This is for my encryption program.
answer="y" #set answer as a variable
while answer=="y" or answer=="yes":

def encryption(plaintext, keyword):
   #pointless including my functions for this question

def decryption(plaintext, keyword):       

question = input("Would you like to encrypt or decrypt a message? ")

if question == 'e' or question == 'encrypt':
    plaintext=input("Please enter the message you wish to encode: ").lower()#plaintext message wished to be encrypted
    keyword=input("Please enter your keyword: ").lower()#keyword that encrypts the message
    encryption(plaintext, keyword)#calls encryption function

elif question == 'd' or question == 'decrypt':
    plaintext=input("Please enter the encrypted message you wish to decrypt: ").lower()
    keyword=input("Please enter your keyword: ").lower()
    decryption(plaintext, keyword)

answer=input("Would you like to restart the program? ").lower()
print("Goodbye")

I tried to use try: and except: but that didn't seem to work or maybe I just used it incorrectly?

A:

to edit or verify an input you need to use a while loop:
while True:
    ans = input('Prompt ')
    if ans:
        break
    print ('You need to type something')

you should also check for valid values before break(ing)
try except is only for exceptions - not entering anything isn't an error it just returns an empty string ''

