It's Sunday, and we all know what that means.
Let's take a crack at this week's Sunday Puzzle from NPR Puzzlemaster Will Shortz:
This week's challenge comes from listener Julia Lewis, of Fort Collins, Colo. Take the name of a major American city. Hidden inside it in consecutive letters is the name of a Japanese food. Remove that. The remaining letters can be rearranged to to spell some Mexican foods. Name the city and the foods.
As usual, let's start with a list of our needs:
- C: A list of major American cities;
- I plan to use this one
- J: A list of Japanese foods;
- This has to fit inside the city name, so it's probably short; I'm guessing it's one of these: sushi, ramen, tofu... we'll expand that if we don't get any matches;
- M: A list of Mexican foods;
- This target word also has to fit in the scrambled remaining letters of the city, so it also needs to be short; I'm going to start with: taco, nacho, salsa... We can expand later if needed;
- St. Paul --> stpaul
- Wilkes-Barre --> wilkesbarre
- for city in C:
- for jfood in J:
- if jfood in city:
- print(city, jfood)
- cityletters = city.replace(jfood, "")
- cityletters = list(cityletters)
- cityletters.sort()
- cityletters = "".join(cityletters) ##now we have a sorted string for easy comparison
- for mf1 in mfoods: ##get sorted strings for mexican food and plural variants
- mf2 = mf1+"s"
- mf3 = mf1+"es"
- mf1letters = list(mf1)
- mf2letters = list(mf2)
- mf3letters = list(mf3)
- mf1letters.sort()
- mf2letters.sort()
- mf3letters.sort()
- m1 = "".join(mfletters)
- m2 = "".join(mf2letters)
- m3 = "".join(mf3letters)
- if cityletters in [m1, m2, m3]:
- print(city, jfood, mf)