when I am run this in IDE, List is created but empty list, how can I solve this?
>>> def findnum(n,m):
print('hellow')
l=list(range(n,m))
>>> findnum(1,10)
hellow
>>> l
[]
when I am run this in IDE, List is created but empty list, how can I solve this?
>>> def findnum(n,m):
print('hellow')
l=list(range(n,m))
>>> findnum(1,10)
hellow
>>> l
[]
Return the list from the function and take it in a separate variable. Here, l is list having data only in the scope of function. The following code snippet might help:
>>> def findnum(n,m):
print('hellow')
l=list(range(n,m))
return l
>>> l = findnum(1,10)