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

@ -16,11 +16,6 @@ in the same way?
from math import ceil
try:
xrange # Python 2
except NameError:
xrange = range # Python 3
def diagonal_sum(n):
"""Returns the sum of the numbers on the diagonals in a n by n spiral
@ -39,7 +34,7 @@ def diagonal_sum(n):
"""
total = 1
for i in xrange(1, int(ceil(n / 2.0))):
for i in range(1, int(ceil(n / 2.0))):
odd = 2 * i + 1
even = 2 * i
total = total + 4 * odd ** 2 - 6 * even