File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
project_euler/problem_009 Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change 55
66A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
77
8- a^2 + b^2 = c^2
8+ a^2 + b^2 = c^2.
99
1010For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
1111
1212There exists exactly one Pythagorean triplet for which a + b + c = 1000.
13- Find the product a*b*c .
13+ Find the product abc .
1414
1515References:
1616 - https://en.wikipedia.org/wiki/Pythagorean_triple
1717"""
1818
1919
2020def get_squares (n : int ) -> list [int ]:
21- res = [0 ] * n
22- for i in range (n ):
23- res [i ] = i * i
24- return res
21+ """
22+ >>> get_squares(0)
23+ []
24+ >>> get_squares(1)
25+ [0]
26+ >>> get_squares(2)
27+ [0, 1]
28+ >>> get_squares(3)
29+ [0, 1, 4]
30+ >>> get_squares(4)
31+ [0, 1, 4, 9]
32+ """
33+ return [number * number for number in range (n )]
2534
2635
2736def solution (n : int = 1000 ) -> int :
You can’t perform that action at this time.
0 commit comments