Assignment 20 – function implementation

Due Monday, October 29 — class will be devoted to this effort



Module magnificent.py (file will be available at the start of class)


Testing



Function beans( a, b, v )

433 beans with length 1.52 and height 0.9 fits in a jar with volume 500

13 beans with length 2 and height 1 fits in a jar with volume 25



Function manhattan_distance( a1, s1, a2, s2 )

Corners ( 6 , 59 ) and ( 7 , 34 ) are 1.4 miles apart

Corners ( 2 , 47 ) and ( 6 , 238 ) are 10.15 miles apart



Function relate( x, y )

kiwi is equal to kiwi

apple comes before banana

orange comes after melon



Function youngest( y )

19 year old can date a 16 year old

22 year old can date a 18 year old



Function is_dateable( y1, y2 )

15 year-old can date a 22 year-old is True

22 year-old can date a 15 year-old is False

19 year-old can date a 18 year-old is True



Function mutually_dateable( y1, y2 )

25 year-old can date a 65 year-old and vice-versa is False

20 year-old can date a 18 year-old and vice-versa is True



Function check_out( dataset, v ).

www.cs1112.org/datasets/csv/co1.csv distribution of 6 is [1, 0, 2, 0]

www.cs1112.org/datasets/csv/co2.csv distribution of 4 is [1, 0, 1, 2, 1, 0]

 


 

 

 
   
   
   
 
  © 2019 Jim Cohoon   Resources from previous semesters are available.