Skip to content

02 Tips & Tricks

mccornet edited this page Jul 25, 2021 · 14 revisions

Tips & Tricks

Math

  • Sum of consecutive integers: 1/2 * n * (n+1)

Python

If the number of iterations is known beforehand; use a for loop instead of while.

if a < b: a = b  # a lot faster than using max
a = max(a, b)

Clone this wiki locally