WEEK02: numbers and strings
---------------------------------------------------------------
 W: more accumulator review; string and list indexing, slicing, and len

LAB2: due next Tuesday
QUIZ1: Friday (do the practice quiz)


* here's our revstr.py program from last time:


"""
Ask user for a string, ouput string in reverse order.

Author: J. Knerr
Date: 09Sep2008
"""

#######################################################

def main():

  text = raw_input("text: ")

  bucket = ""

  for char in text:
    bucket =  char + bucket  # add to beginning of string

  print bucket


#######################################################
main()

 - I used an accumulator, but added the char variable to the
   front of my bucket (the reversed string I am building, one
   character at a time)

 - note the initial empty bucket is "" for strings (0 for numbers)

# ----------------------------------------------------- #

* How about a grade-averaging program, like this:

$ python grade_ave.py 

please enter # of grades: 5

grade 1: 100
grade 2: 90
grade 3: 80
grade 4: 70
grade 5: 60

the sum of those grades is:  400
the ave of those grades is:  80.0

 Use an accumulator to sum all of the grades the user enters,
 then calculate the average grade. And be careful with ints and
 floats when you do the division...