First Project Euler solution To continue learning I decided to try solving some of project Euler problems. Here is the first solution.

The things I'm interested the most from the review are:


The performance of the code 
Overall review of the code structure, styling rules and naming conventions.




Problem: 1


  Find the sum of all the multiples of 3 or 5 below 1000.


#----------------------------------------------------------------------------------
def calculate_the_sum(threshold = 10):
    """Calculates the sum of all multiples of 3 or 5
    below the provided threshold.

    Arguments:
       type:&lt;int&gt; -Preforms the calculations on all values up to this value.
    Return:
       type:&lt;int&gt; -The sum of numbers that are multiples of 3 or 5..
    """
    return sum(n for n in range(threshold) if n % 3 == 0 or n % 5 == 0)

#----------------------------------------------------------------------------------
def main():

    threshold = 1000
    print(' Calculates the sum of all numbers that are multiples of 3 or 5')
    print(' The Sum of numbers below {} is: {}'.format(threshold,calculate_the_sum(threshold)))

#----------------------------------------------------------------------------------
if __name__ == "__main__":
    main()
For the first problem I suggest you some performance improvements. You can use inclusion-exclusion technique for this problem.

So first improvement

def calculate_the_sum(threshold = 10):
    return(sum(range(3, threshold, 3)) + sum(range(5, threshold, 5)) - sum(range(15, threshold, 15)))

def main():
    threshold = 1000000
    print(' Calculates the sum of all numbers that are multiples of 3 or 5')
    print(' The Sum of numbers below {} is: {}'.format(threshold,calculate_the_sum(threshold)))

if __name__ == "__main__":
    main()


I have tested both solutions in ideone (Python 3) for threshold=1000000. Your solution ~ 0.20s. My ~ 0.05s.

Next – you can use well known formula for the sum of arithmetic progression.