This week's puzzle is a pretty straightforward solve, fortunately. Let's take a look:
This week's challenge comes from listener Al Gori, of Oak Ridge, N.J. Name a famous city in 10 letters that contains an "S." Drop the "S." Then assign the remaining nine letters their standard value in the alphabet — A = 1, B= 2, C = 3, etc. The total value of the nine letters is only 25. What city is it?
To solve this puzzle, we need:
- C: a list of cities;
- I'm planning to use this one; it looks pretty good, and it's downloadable as a CSV, so we can easily pull the names from that without needing to scrape and clean HTML.
- We'll filter this so that we keep only city names that contain 10 letters (not counting spaces, hyphens, etc.) and exactly one 's'.
- function_lvs: Letter value sum function to take a string (a city name), look up the numerical value in the alphabet for each letter (minus the 's') and return that sum;
- for c in C:
- if function_lvs(c) == 25:
- print("Solution! "+c)
Come back here after NPR's Thursday deadline to see my solution and implementation. Good luck!
No comments:
Post a Comment