Dec-14-2016, 02:29 PM
as in your main() function, use a while statement
def sub(): while True: try: num1 = int(input("Give a number: ")) num2 = int(input("Give a number: ")) except (TypeError, ValueError): print("This input is invalid.") # sub() continue else: return num1, num2You should also account for division by zero (selections 4, 5 and 6). You do not wish to use decimal numbers?
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition