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,7 +7,6 @@ For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
|
||||
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
|
||||
Find the product abc.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
def solution():
|
||||
@ -17,7 +16,7 @@ def solution():
|
||||
1. a < b < c
|
||||
2. a**2 + b**2 = c**2
|
||||
3. a + b + c = 1000
|
||||
|
||||
|
||||
# The code below has been commented due to slow execution affecting Travis.
|
||||
# >>> solution()
|
||||
# 31875000
|
||||
|
@ -7,14 +7,6 @@ For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
|
||||
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
|
||||
Find the product abc.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
try:
|
||||
raw_input # Python 2
|
||||
except NameError:
|
||||
raw_input = input # Python 3
|
||||
|
||||
|
||||
def solution(n):
|
||||
"""
|
||||
Return the product of a,b,c which are Pythagorean Triplet that satisfies
|
||||
@ -22,7 +14,7 @@ def solution(n):
|
||||
1. a < b < c
|
||||
2. a**2 + b**2 = c**2
|
||||
3. a + b + c = 1000
|
||||
|
||||
|
||||
>>> solution(1000)
|
||||
31875000
|
||||
"""
|
||||
@ -41,4 +33,4 @@ def solution(n):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(solution(int(raw_input().strip())))
|
||||
print(solution(int(input().strip())))
|
||||
|
@ -10,9 +10,6 @@ For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
|
||||
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
|
||||
Find the product abc.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
def solution():
|
||||
"""
|
||||
Returns the product of a,b,c which are Pythagorean Triplet that satisfies
|
||||
|
Reference in New Issue
Block a user