** to run this program which add element into list ** error int object is not iterable
d={'a':[1,4]}
d['a']. extend (34)
** to run this program which add element into list ** error int object is not iterable
d={'a':[1,4]}
d['a']. extend (34)
d['a']
is a list. To add a single element to that list, either use append()
or call extend()
with an iterable (such as a list or a tuple):
d['a'].append(34)
d['a'].extend([34])
For further background, see What exactly are iterator, iterable, and iteration?