mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
Simplify code by dropping support for legacy Python (#1143)
* Simplify code by dropping support for legacy Python * sort() --> sorted()
This commit is contained in:
@@ -4,15 +4,9 @@ The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
|
||||
|
||||
Find the sum of all the primes below two million.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
import math
|
||||
from itertools import takewhile
|
||||
|
||||
try:
|
||||
raw_input # Python 2
|
||||
except NameError:
|
||||
raw_input = input # Python 3
|
||||
|
||||
|
||||
def primeCheck(number):
|
||||
if number % 2 == 0 and number > 2:
|
||||
@@ -30,7 +24,7 @@ def prime_generator():
|
||||
|
||||
def solution(n):
|
||||
"""Returns the sum of all the primes below n.
|
||||
|
||||
|
||||
# The code below has been commented due to slow execution affecting Travis.
|
||||
# >>> solution(2000000)
|
||||
# 142913828922
|
||||
@@ -47,4 +41,4 @@ def solution(n):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(solution(int(raw_input().strip())))
|
||||
print(solution(int(input().strip())))
|
||||
|
||||
Reference in New Issue
Block a user