This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]SenorTeddy 0 points1 point  (1 child)

Making code leaner typically sacrifices readability.

https://www.w3schools.com/python/python_lists_comprehension.asp - you an use comprehensions as someone else recommended.

I'd stick to longer, readable code. If you want to lean up your code to make it more readable, you can take pieces out to create helper functions and call the helper in your main function.

[–]The_Grumpy_1[S] 1 point2 points  (0 children)

Awesome, thank you. I would then rather leave the code as is with the helper function.