Skip to content

Commit 29afb70

Browse files
committed
Add new file
1 parent 6fa073e commit 29afb70

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: product.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#Got this on my first try!
2+
#Define a function called product that
3+
# takes a list of integers as input and returns the product
4+
# of all of the elements in the list.
5+
# For example: product([4, 5, 5]) should return 100 (because 4 * 5 * 5 is 100).
6+
7+
def product(x):
8+
num = 1
9+
for i in x:
10+
num *= i
11+
return num
12+
13+
print product([4,5,4])

0 commit comments

Comments
 (0)