Tips and Tricks for Code Golfing in Python

Everything is in the title !
What are your tricks ?
I’m stuck on the Thor size coding puzzle, and I see that some people manage to get half the best size I can get, so I’m… puzzled :wink:

So what are your tricks ?

I think you should go for a ride on this page: Tips for golfing in Python

You will find many tricks to shorten your code. :stuck_out_tongue:

Once these tips are known, you must think carefully about how to structure your code optimally. There are often several ways to explore, you have to choose the best one.

1 Like