Class 21 — Wednesday, October 13

Look at the map

I say love is love — For aren’t we all just people — Living as we are


Look both ways


Agenda


To do


Examples


Some data sets


Problem romantic.py

Some program runs

Enter Roman numeral: V

5

Enter Roman numeral: d

500

Enter Roman numeral: 0

Unknown



Problem unromantic.py

Some program runs

RecursionError: maximum recursion depth exceeded during compilation



Discussion

flora_to_color = { 'spruce': 'green', 'apple': 'red', 'shamrock': 'green',

  'banana': 'yellow', 'potato': 'brown', 'eggplant': 'purple' }

flora_to_color[ 'lemon' ] = 'yellow'

flora_to_color[ 'potato' ] = 'golden'

would cause flora_to_color to lose its association of mapping potato to brown — its association with 'potato' is now only to golden.

the_keys = flora_to_color.keys()

the_values = flora_to_color.values()

While there are never any duplicates in the keys, depending upon the dictionary there may be duplicates in the values.


Problem even_odd.py

Some program runs

Enter a number: 3

3 odd

Enter even or odd: even

a number is even if its remainder divided by 2 is 0

Enter a number: 6

6 even

Enter even or odd: odd

a number is odd if its remainder divided by 2 is 1



Problem good_doggie.py

http://www.cs.virginia.edu/~cs1112/datasets/csv/puppies.csv

  • Sequential
  • Nested
  • Mixture of nested and sequential

Where am I

jpc @ love is love