Not getting output

Jussi Piitulainen jussi.piitulainen at helsinki.fi
Tue Oct 11 14:25:04 EDT 2016


dhawanpawan32 at gmail.com writes:

> def abc(a,b):
>     l=[]
>     for i in range(a,b+1):
>         if i%2!=0:
>             
>             l.append(i)
>     print l    
>     return 1
>
> def bg():
>     y=abc(11,31)
>     print y
>
> I am not getting the output, but if i call method abc outside the
> function then it's coming

Do you perhaps expect abc to return the list that it builds and prints?
If so, use some other name than l. One that doesn't look so much like
the number 1.



More information about the Python-list mailing list