# Arup Guha
# 9/24/2020
# While Loop Example: Collecting Donations until a goal is reached.
# Version 2: Calculates the average donation.

# Get goal amount.
goal = int(input("How many dollars would you like to raise?\n"))

# Right now we have no money.
total = 0

# Keep track of how many houses we go to.
numHouses = 0

# Keep on collecting until we reach or exceed the goal.
while total < goal:

    # Get the donation and add it to our accumulator.
    # Also update # of houses accumulator.
    money = int(input("How much are you donating?\n"))
    total = total + money
    numHouses = numHouses + 1

# Print out how much collected.
print("You collected",total,"dollars after asking for",numHouses,"donations.")

# Print out average donation.
print("The average donation was",total/numHouses,"dollars")
