Skip to content

Commit 1c59289

Browse files
authored
Creating a file for the squares series
1 parent 81b6956 commit 1c59289

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Series/squares

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
+# squares.py
2+
+""" Squares takes the number of elements Num, and returns a list containing "Num" first squares.
3+
+ Pre-Conditions - Num should be an integer >=1.
4+
+
5+
+ Squares(10) --> Standard function call
6+
+
7+
+ Output --> Num first squares (1^2,2^2,...,Num^2)
8+
+
9+
+ Example:
10+
+
11+
+ Squares(1) returns --> [1]
12+
+ Squares(3) returns --> [1,4,9]
13+
+"""
14+
+
15+
+
16+
+def Squares(Num):
17+
+ return [i**2 for i in range(1,Num)]
18+
+
19+
+
20+
+if __name__ == '__main__':
21+
+ print(Squares(1))
22+
+ print(Squares(3))

0 commit comments

Comments
 (0)