HW06

pdf

School

Harvard University *

*We aren’t endorsed by this school

Course

2396

Subject

Computer Science

Date

Apr 3, 2024

Type

pdf

Pages

7

Uploaded by agentjake7

Report
HW06.py Test failed: False is not true
dict str list 'vanilla' 'Vanilla' >>> restaurants = { "Cold Stone" : ( "Cookies n Cream" , "Vanilla" ), "Dairy Queen" : ( "vanilla" , "chocolate" , "coffee" ), "Steak n Shake" : ( "Peanut Butter" ,) } >>> flavor = "Vanilla" >>> milkshakes(restaurants, flavor) [ 'Cold Stone' , 'Dairy Queen' ] >>> restaurants = { "Olive Garden" : ( "Vanilla" ,), "McDonalds" : ( "Vanilla-Chocolate Swirl" , "Double Chocolate" ), "Chick-Fil-A" : ( "Frozen Lemonade" ,) } >>> flavor = "Frozen Lemonade" >>> milkshakes(restaurants, flavor) [ 'Chick-Fil-A' ] list str dict
"a" < "b" == True >>> words = [ "abracadabra" , "ambidextrous" , "amphibian" , "astronaut" , "frog" ] >>> letter = "d" >>> letterCounter(words, letter) { 'abracadabra' : 8 , 'ambidextrous' : 2 , 'amphibian' : 3 , 'astronaut' : 2 , 'frog' : 0 } >>> words = [ "rainbow" , "bloom" , "sunny" , "moon" , "trees" ] >>> letter = "p" >>> letterCounter(words, letter) { 'rainbow' : 5 , 'bloom' : 5 , 'sunny' : 2 , 'moon' : 4 , 'trees' : 2 } list list tuple
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
>>> numerators = [ 1 , 2 , 4 , "&" , 0 , 4 ] >>> denominators = [ 0 , 3 , 5 , 7 , 9 , 13 ] >>> calculator(numerators, denominators) ( 1.77 , 2 ) >>> numerators = [ 8 , 12 , 4 , "%" , 0 , 20 ] >>> denominators = [ 1 , 4 , 0 , 9 , 0 , 10 ] >>> calculator(numerators, denominators) ( 13.0 , 3 ) dict dict { store1: { candy1: price1, candy2: price2, . . . }, store2: { candy1: price1, candy2: price2, . . . } }
>>> stores = { 'Target': { 'Kitkat': 1, 'Hersheys Kisses': 0.25 }, 'Publix': { 'Swedish Fish': 0.75, 'Hersheys Kisses': 5.24 }, 'Walmart': { 'Kitkat': 0.84, 'Rice Krispie Treats': 0.56 } } >>> candyShopping(stores) {'Target': 'Hersheys Kisses', 'Publix': 'Swedish Fish', 'Walmart': 'Rice Krispie Treats'} >>> stores = { 'Whole Foods' : { 'Gummy Bears' : 0.43 , 'Peanut Butter Cups' : 0.66 }, 'Kwik-E-Mart' : { 'M&Ms' : 0.07 , 'Gummy Bears' : 0.17 , 'Twizzlers' : 0.21 }, 'Barnes and Noble' : { 'Peanut Butter Cups' : 0.5 , 'M&Ms' : 0.09 } } >>> candyShopping(stores) { 'Whole Foods' : 'Gummy Bears' , 'Kwik-E-Mart' : 'M&Ms' , 'Barnes and Noble' : 'M&Ms' }
dict dict .sort() sorted() >>> students = { 'arvin' : [ 'cs1301' , 'cs3510' , 'id2242' ], 'anthony' : [ 'cs1301' , 'math3012' , 'id2242' ], 'arushi' : [ 'math3012' , 'cs1301' , 'cs3510' ] } >>> classRoster(students) { 'cs1301' : [ 'anthony' , 'arushi' , 'arvin' ], 'cs3510' : [ 'arushi' , 'arvin' ], 'id2242' : [ 'anthony' , 'arvin' ], 'math3012' : [ 'anthony' , 'arushi' ]} >>> students = { 'craig' : [ 'cs1301' , 'cs2050' , 'cs2110' ], 'michael' : [ 'cs1332' , 'cs4400' , 'cs1301' ], 'alexa' : [ 'lmc3403' , 'cs1301' , 'cs2340' ], 'bob' : [ 'engl1101' , 'eas1600' , 'apph1040' ] } >>> classRoster(students) { 'cs1301' : [ 'alexa' , 'craig' , 'michael' ], 'cs2050' : [ 'craig' ], 'cs2110' : [ 'craig' ], 'cs1332' : [ 'michael' ], 'cs4400' : [ 'michael' ], 'lmc3403' : [ 'alexa' ], 'cs2340' : [ 'alexa' ], 'engl1101' : [ 'bob' ], 'eas1600' : [ 'bob' ], 'apph1040' : [ 'bob' ]}
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
HW06.py HW06.py HW06.py