mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-19 19:03:02 +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:
@ -7,11 +7,6 @@ The series, 11 + 22 + 33 + ... + 1010 = 10405071317.
|
||||
Find the last ten digits of the series, 11 + 22 + 33 + ... + 10001000.
|
||||
"""
|
||||
|
||||
try:
|
||||
xrange
|
||||
except NameError:
|
||||
xrange = range
|
||||
|
||||
|
||||
def solution():
|
||||
"""Returns the last 10 digits of the series, 11 + 22 + 33 + ... + 10001000.
|
||||
@ -20,7 +15,7 @@ def solution():
|
||||
'9110846700'
|
||||
"""
|
||||
total = 0
|
||||
for i in xrange(1, 1001):
|
||||
for i in range(1, 1001):
|
||||
total += i ** i
|
||||
return str(total)[-10:]
|
||||
|
||||
|
Reference in New Issue
Block a user