Section 9 review


#1


I keep receiving an error that a single element list is not iterable. Is this section about validating inputs?


Replace this line with your code.


#2

Attempting to discern the error message, single element list is not iterable...

In Python 2.7.x

 > l = []
 > for i in l: 
..     print (i) 
..     
 > l+=[1]
 > l
=> [1]
 > for i in l: 
       print (i) 
.. 	
 1
 >

In Python 3.5.x

>>> l = []
>>> for i in l:
        print (i)

    
>>> l+=[1]
>>> l
[1]
>>> for i in l:
        print (i)

    
1
>>>

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.