
Weekly Challlenge: The subnet detector
Weekly Challenge 363 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: String Lie Detector Task You are given a string. Write a script that parses a self-referential string and determines whether its claims about itself are true. The string will make statements about its own composition, specifically the number of vowels and consonants it contains. My solution This was relatively straight forward in Python. I took the following steps: Use a regular expression to extract the necessary parts of the input_string , and store this as the value match . Count the number of vowels and consonants in the first value and store it as vowel_count and const_count . Use
Continue reading on Dev.to Python
Opens in a new tab




