Reputation: 31
I am trying to import the answer of a function. The function is this:
def flo(rate,length, interval, threshold):
data = [] #to create an empty list
new = [rate[i:i+ length] for i in range(0, len( rate)-len( rate) % length , length)]
for i in range(len(new )):
data.append('True')
print(data)
return
flo( rate,length, interval, threshold)
where I got the output:
[False]
[False, False]
[False, False, True]
[False, False, True, True]
[False, False, True, True, True]
[False, False, True, True, True, False]
[False, False, True, True, True, False, True]
[False, False, True, True, True, False, True, True]
[False, False, True, True, True, False, True, True, False]
Now I want to import this answer into another function. So I did:
import flow_rate as flow
z = flow.flow_rate ( rate, length, interval, threshold)
print(z)
But my output is:
None
Am I doing something wrong?
Upvotes: 0
Views: 413
Reputation:
You simply put a return
statement. There is not variable after return
, so None
is getting returned. It is as good as the return
statement is not present in the function.
So you need to return the data:
return data
Upvotes: 2