def Product(number):
Products = []
for i in range(100,999):
Products.append(number*i)
print(Product(300))
Asked
Active
Viewed 33 times
-2

mmdanziger
- 4,466
- 2
- 31
- 47

AFlyingKiwi
- 21
- 4
-
It does sth inside but you do not return anything – SpghttCd May 23 '18 at 00:09
-
You build your list just fine. But you don't _return_ it, or anything else. So your function just returns the default `None` value. Just do a `return Products` at the end (indented at the same level as `for`, not `Products.append`) and it'll work. – abarnert May 23 '18 at 00:09
-
As mentioned just `return` the list... note Python has some powerful list comprehension capabilities that would make this more concise, e.g. your function body could be replaced with `return [number*i for i in range(100, 999)]` – AChampion May 23 '18 at 00:11
1 Answers
0
Your function doesn't return anything. This works:
def Product(number):
Products = []
for i in range(100,999):
Products.append(number*i)
return Products
print(Product(300))

mmdanziger
- 4,466
- 2
- 31
- 47