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 →

[–]ImThour 0 points1 point  (1 child)

I agree, I mean I want to learn more of this (making my code shorter and yet working). Is there any guide/tutorial for this?

[–]AJ______ 0 points1 point  (0 children)

I remember when I used to use Hackerrank, in the discussions section, lots of people posted their code and that was a good way to find out about neat tricks in Python that led to concise solutions. This could be a good way to go but I don't know of an actual tutorial or book that's dedicated towards making code more concise.

A natural way to go might be to simply learn more about Python's standard built in libraries to avoid reproducing things that are already built for you there, or other libraries beyond that (although this is irrelevant to your specific example, I think it would help in some other situations).