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 5
5
6
6
A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
7
7
8
- a^2 + b^2 = c^2
8
+ a^2 + b^2 = c^2.
9
9
10
10
For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
11
11
12
12
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
13
- Find the product a*b*c .
13
+ Find the product abc .
14
14
15
15
References:
16
16
- https://en.wikipedia.org/wiki/Pythagorean_triple
17
17
"""
18
18
19
19
20
20
def 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 )]
25
34
26
35
27
36
def solution (n : int = 1000 ) -> int :
You can’t perform that action at this time.
0 commit comments