CNF solution in Creative category for House Password by veky
checkio=lambda d:9 Sept. 28, 2014 Comments: smjefferson602 on Sept. 28, 2014, 11:40 p.m. <p>man, comprehensions still seem like magic to me! :{)</p> veky on Sept. 28, 2014, 11:50 p.m. <p>Not magic, just illusionism, as I like to say. :-)</p> <p>Write code, see what's repeated, factor it out; whatever is left, put it in sequence to iterate through. Simple. :-)</p> <p>Of course, I could factor out even more:</p> <pre class='brush: python'>any(map(getattr(str, "is" + t), d)) for t in "digit upper lower".split() </pre> <p>But then it'd be too long. ;-]</p> xiaozhan on Nov. 11, 2015, 7:19 a.m. <p>Mine <a href="http://www.checkio.org/mission/house-password/publications/xiaozhan/python-3/first/">here</a>.</p> petrch on Sept. 17, 2017, 9:46 a.m. <p>am I right that this only works because of the precondition re.match("[a-zA-Z0-9]+", password)? otherwise I like it as an alternative to the regex solution with forward lookups.</p> veky on Sept. 24, 2018, 8:28 a.m. <p>It quite literally checks whether the password has length greater than 9, and whether it contains a digit, an uppercase character, and a lowercase character. What more would you want? :-)</p> bsquare on Sept. 18, 2019, 9:42 a.m. <p>Haha! At first it is like Vodoo ... then it is obvious talent;)</p> <p>Thanks for your solutions:)</p> veky on Sept. 18, 2019, 9:44 a.m. <p>If you know Conjunctive Normal Form from logic, it shouldn't be so surprising. :-)</p>
Sept. 28, 2014
Comments: