Hiya Puzzlers! After a total fail last week, I'm back with a solution for this week's puzzle. That's your spoiler alert---solution is at the end of this post.
I didn't post a preview this week, so I'll do a full breakdown here. Let's see this week's Sunday Puzzle:
This week's challenge comes from listener Peter Collins, of Ann Arbor, Mich. Think of a country. Embedded in consecutive letters is a well-known brand name. The first, second, eighth and ninth letters of the country, in order, spell a former competitor of that brand. Name the country and the brands.
This is quite similar to the puzzle we solved two weeks ago. In that puzzle, there was a Japanese food embedded in the name of a US city, and then the remaining letters could be used to spell a Mexican food. The first part is very similar, but we don't have the unscrambling spelling part this time. So I started my solver script for the current puzzle by recycling the city/foods puzzle solver script.
To solve this puzzle we need:
- C: a list of countries;
- This is easy enough to find online, but we've already got this list on hand from previous puzzles; I'm lazily pasting it into my python solver script, i.e., hard coding it;
- Pro-tip: you'll want to be flexible with what you accept in your list and include variant names; e.g., "Côte d'Ivoire" and "Ivory Coast" and "Republic of Côte d'Ivoire";
- We'll also want to ASCII-fy this list: e.g., "Côte d'Ivoire" --> "Cote d'Ivoire";
- I do this in the solver script with slugify, which also lowercases letters;
- And we'll want to remove any non-letters: "cote d'ivoire" --> "cotedivoire";
- And we know we need at least 9 letters, so we'll go ahead and filter any shorter strings out of our list;
- B: a list of brands;
- I cobbled one together from various lists on the web; I also hard coded directly this into my solver script;
- We'll want to handle these similarly to the country names: ASCII-fy, remove whitespace and non-letters, and lowercase everything;
- for country in C:
- for brand in B:
- if brand in country:
- competitor = country[0]+country[1]+country[7]+country[8]
- if competitor in B:
- print("Solution: "country+" & "+brand+" & "+competitor)
No comments:
Post a Comment