
"""
Sawyer Hood
Introductory example of functions.

"""


#Our main method. It repeatedly asks the user for input and 
#calls the add() and mult() functions.
def main():
    numbers = []
    getInput(numbers)
    print("The numbers entered add up to {0}.".format(add(numbers)))
    print("The product of the numbers entered is {0}.".format(mult(numbers)))
    

#Adds a list of numbers and returns a value, note how this 
#is different from a method that doesn't return a value
def add(numbers):
    total = 0
    for num in numbers:
        total += num
    return total

#Multiplies a list of numbers and returns an integer.
def mult(numbers):
    product = 1
    for num in numbers:
        product *= num
    return product

#Processes input until 'stop' is entered.
def getInput(numbers):
    moreValues = True
    while moreValues:
        val = input("Please enter a number, type 'stop' to calculate: ")
        if val == "stop":
            moreValues = False
        else:
            numbers.append(int(val))

main()

        
        

    