Simplify code by dropping support for legacy Python (#1143)

* Simplify code by dropping support for legacy Python

* sort() --> sorted()
This commit is contained in:
Christian Clauss
2019-08-19 15:37:49 +02:00
committed by GitHub
parent 32aa7ff081
commit 47a9ea2b0b
145 changed files with 367 additions and 976 deletions

View File

@ -6,14 +6,8 @@ By listing the first six prime numbers:
We can see that the 6th prime is 13. What is the Nth prime number?
"""
from __future__ import print_function
from math import sqrt
try:
raw_input # Python 2
except NameError:
raw_input = input # Python 3
def isprime(n):
if n == 2:
@ -30,7 +24,7 @@ def isprime(n):
def solution(n):
"""Returns the n-th prime number.
>>> solution(6)
13
>>> solution(1)
@ -58,4 +52,4 @@ def solution(n):
if __name__ == "__main__":
print(solution(int(raw_input().strip())))
print(solution(int(input().strip())))