# Exercise 10-7 Addition Calculator 
# Learning Objective: Prevent crashes using try except in a while loop. 

print("Welcome, please remember to press n to quit")

active = True

def add_numbers(num1, num2):
    try:
        answer = int(num1) + int(num2)
    except ValueError:
        error_message = "Input must be an integer, try again.\n"
        return error_message
    else:
        return answer
while active == True:
    num1 = input("Enter number to add: ")
    num2 = input("Enter a second number to add: ")
    print(add_numbers(num1, num2))
    try:
        question = input("Continue? ")
        if question.lower() == 'n' or question.lower() == 'no': 
            active = False
    except:
        print("Not a valid input.")
        pass         
    
        
