Menu

Weekly Challenge: Popular Scrambling
📰
0

Weekly Challenge: Popular Scrambling

DEV Community·Simon Green·about 1 month ago
#M1eBRmEg
#task#my#examples#python#fullscreen#return
Reading 0:00
15s threshold

Weekly Challenge 370 Each week Mohammad S. Anwar sends out The Weekly Challenge , a chance for all of us to come up with solutions to two weekly tasks. My solutions are written in Python first, and then converted to Perl. Unless otherwise stated, Copilot (and other AI tools) have NOT been used to generate the solution. It's a great way for us all to practice some coding. Challenge , My solutions Task 1: Popular Word Task You are given a string paragraph and an array of the banned words. Write a script to return the most popular word that is not banned. It is guaranteed there is at least one word that is not banned and the answer is unique. The words in paragraph are case-insensitive and the answer should be in lowercase. The words can not contain punctuation symbols. My solution These are the steps I took to solve this challenge. Convert the banned words list to lower case, and store this as banned_list . Create a list called words that has all the words that aren't in the banned_list list or empty.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More