# Define a procedure, total_enrollment,
# that takes as an input a list of elements,
# where each element is a list containing
# three elements: a university name,
# the total number of students enrolled,
# and the annual tuition fees.

# The procedure should return two numbers,
# not a string, 
# giving the total number of students
# enrolled at all of the universities
# in the list, and the total tuition fees
# (which is the sum of the number
# of students enrolled times the
# tuition fees for each university).

udacious_univs = [['Udacity',90000,0]]

usa_univs = [ ['California Institute of Technology',2175,37704],
              ['Harvard',19627,39849],
              ['Massachusetts Institute of Technology',10566,40732],
              ['Princeton',7802,37000],
              ['Rice',5879,35551],
              ['Stanford',19535,40569],
              ['Yale',11701,40500]  ]
usa_univs1 = [['California Institute of Technology',215,3774],
          ['Harvard',1967,3949],
          ['Massachusetts Institute of Technology',1056,4732],
          ['Princeton',782,3700],
          ['Rice',579,3555],
          ['Stanford',1953,4056],
          ['Yale',1701,4050]]

def total_enrollment(uni):
    stu = 0
    fee = 0
    for i in uni:
        stu = stu + i[1]
        fee = fee + i[2]*i[1]
    return stu, fee


print total_enrollment(udacious_univs)
print total_enrollment(usa_univs)
print total_enrollment(usa_univs1)

#>>> (77285,3058581079)

