Pset 5, problem 1. Anybody know how to use the dictionary? Each letter from a to z were given a value, how to use the value to calculate the score?
MIT 6.00 Intro Computer Science (OCW)
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
Link please? I'm not following the course, but I'll be able to help. :)
Here's the link http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/assignments/pset5.pdf
the value of any letter is called by SCRABBLE_LETTER_VALUES [l] where "l" is the letter.
Not the answer you are looking for? Search for more explanations.
Ok. Dictionary is a structure that maps keys to values. Each key can have only one value associated with it (that value can be a list or some other structure though).
In Python, if 'd' is a dictionary, then expression 'd[k]' yields a value associated with key 'k' if that key is present in 'd' - otherwise an exception is thrown.
Symmetrically, an expression 'd[k] = v' assigns value 'v' to the key 'k'.
In that exercise you're given a pre-populated dictionary that has all the letters as keys, and each of them is associated with a score.
Is it clear now?