Advertisement
Anaryl

Untitled

Aug 25th, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. # Define a procedure, total_enrollment,
  2. # that takes as an input a list of elements,
  3. # where each element is a list containing
  4. # three elements: a university name,
  5. # the total number of students enrolled,
  6. # and the annual tuition fees.
  7.  
  8. # The procedure should return two numbers,
  9. # not a string,
  10. # giving the total number of students
  11. # enrolled at all of the universities
  12. # in the list, and the total tuition fees
  13. # (which is the sum of the number
  14. # of students enrolled times the
  15. # tuition fees for each university).
  16.  
  17. udacious_univs = [['Udacity',90000,0]]
  18.  
  19. usa_univs = [ ['California Institute of Technology',2175,37704],
  20. ['Harvard',19627,39849],
  21. ['Massachusetts Institute of Technology',10566,40732],
  22. ['Princeton',7802,37000],
  23. ['Rice',5879,35551],
  24. ['Stanford',19535,40569],
  25. ['Yale',11701,40500] ]
  26.  
  27. def total_enrollment():
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35. #print total_enrollment(udacious_univs)
  36. #>>> (90000,0)
  37.  
  38. # The L is automatically added by Python to indicate a long
  39. # number. If you are trying the question in an outside
  40. # interpreter you might not see it.
  41.  
  42. #print total_enrollment(usa_univs)
  43. #>>> (77285,3058581079L)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement