79169135

Date: 2024-11-08 07:27:25
Score: 1
Natty:
Report link

I want to offer the beginner another way to solve the problem: with using elements of functional programming. As a rule, such solutions are more compact and clear:

from itertools import takewhile
list1 = [1,2,3,4,5,6,7]
[print(a) for a in takewhile(lambda a: a > 4, reversed(list1))]
Reasons:
  • RegEx Blacklisted phrase (1): I want
  • Low length (0.5):
  • Has code block (-0.5):
Posted by: Konstantin Makarov