The following python codes lead to the AttributeError:, Any suggestion for rectification? -
i trying result comb. following error follows. can suggestions resolve error?
import math  def chirp(n):         l=[]              in range(3141):         i1=i/10.         s=math.sin(n*i1)         l=l.append(s)     return l l1=chirp(10,1) l2=chirp(20,1)  l3=chirp(40,1) comb= l1+l2+l3 print comb   error:
traceback (most recent call last):   file "test.py", line 17, in <module>     l1=chirp(10,1)   file "test.py", line 15, in chirp     l=l.append(s) attributeerror: 'nonetype' object has no attribute 'append'      
change line
l = l.append(s)   to just
l.append(s)   append mutates list, don't have @ return value (which none).
Comments
Post a Comment