[Tutor] List of tuples

Alan Gauld alan.gauld at yahoo.co.uk
Tue Apr 19 19:08:25 EDT 2016


On 19/04/16 21:56, isaac tetteh wrote:
> I have a list like this 

> [
> ("name",2344,34, "boy"),("another",345,47,"boy", "last")
> ]

Assuming this is list_tuple...

> for row in list_tuple:
>     for row2 in row:
>         return row

This can't work because return needs to be inside a function.
So you obviously are not showing us all of your code.
Also the code above would not give the error you report.

So we need to see the whole code and the whole error message.

Also can you explain how you want the output presented.
Do you want values returned from a function or do you want
them printed on screen or do you want them represented
by a string? Your mail suggests you wanted them printed
but your code suggests you want them returned from a
function. Which is it?


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list