[Tutor] Print List
Oscar Benjamin
oscar.j.benjamin at gmail.com
Wed Sep 12 18:10:54 CEST 2012
On Sep 12, 2012 4:53 PM, "Ashley Fowler" <afowler2 at broncos.uncfsu.edu>
wrote:
>
> I am trying to complete the following below:
>
>
> You also need to write a function "printList" of one parameter that
> takes a list as its input and neatly prints the entire contents of the
> list in a column. Each student in the list should be printed using
__str__.
>
>
> So far i have:
>
>
> def printList(lists):
> print("First Name\tLast Name\tCredits\tGPA")
> for i in lists:
> print (i)
>
>
> Any Suggestions or Corrections?
Looks good to me.
My only suggestion is to use more descriptive names. I would have called it
'students' instead of 'lists' and 'student' instead of 'i'. I don't really
like 'printList' either but I guess your stuck with that.
Oscar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120912/a03c1d81/attachment.html>
More information about the Tutor
mailing list