How to print an error message and exit after a while loop ends?
Posted on 2014-08-19
I have a program in python 3 with a global variable for my counter, while counter <= 3, gets the user input, goes to a function to validate and increments the counter in the validation function. After three invalid data entries in a row, it needs to display an error message and exit. It exits the while loop after the three invalid attempts in a row, but I don't know where to put the error message and how to make it exit. If the user enters invalid data, say twice and the third time enters good data how to reset the counter and start the process all over again.