diff --git a/Project Euler/Problem 10/sol1.py b/Project Euler/Problem 10/sol1.py index ca9593afa..eace01a46 100644 --- a/Project Euler/Problem 10/sol1.py +++ b/Project Euler/Problem 10/sol1.py @@ -1,6 +1,12 @@ from __future__ import print_function from math import sqrt +try: + xrange # Python 2 +except NameError: + xrange = range # Python 3 + + def is_prime(n): for i in xrange(2, int(sqrt(n))+1): if n%i == 0: @@ -30,4 +36,4 @@ if __name__ == '__main__': n = int(sys.argv[1]) print(sum_of_primes(n)) except ValueError: - print('Invalid entry - please enter a number.') \ No newline at end of file + print('Invalid entry - please enter a number.')