I have two similar functions function def A() and function def B() written so far, and it works, but I would like to do it, so that after a user finishes writing data in function B(),… he is given an option to either quit, or begin the process again with writing data in function A()
So that theoretically, user could repeat the process a million times before he (for example) hits ENTER to quit the program.
How would I achieve that?
def A(parameters):
content...
...
...
def B(parameters):
content...
...
...
Press R to repeat with def A (parameters), press Q to quit:
It’s probably better to merge the functionality of
A()withB()and pass a flag, however here is a solution that allowsA()to be called afterB()until the user hitsRETURN:Output:
Some notes:
lower()returns whatever the user types as all lowercase characters allowingrandRto be treated the same.strip()removes any leading or trailing whitespace from the input.