Newline (NuBe Question)

Pierre Fortin pf at pfortin.com
Wed Nov 15 12:19:16 EST 2023


On Wed, 15 Nov 2023 16:51:09 -0000 Grizzy Adams via Python-list wrote:

I don't give solutions; just a nudge...  you appear not to fully grok
"list"; your list is ONE list with no delineation between students. You
want a "list of lists"...

>['Example High', 'Mary', 89.6, 'Pass', 'Example High', 'Matthew', 76.5, 'Fail', 'Example High', 'Marie', 80.4, 'Fail', 'Example High', 'Manuel', 79.6, 'Fail', 'Example High', 'Malala', 98.9, 'Pass']

Like this:

students = [
    ['Example High', 'Mary', 89.6, 'Pass'],
    ['Example High','Matthew', 76.5, 'Fail'],
    ['Example High', 'Marie', 80.4, 'Fail'],
    ['Example High', 'Manuel', 79.6, 'Fail'],
    ['Example High', 'Malala', 98.9, 'Pass']
]

This may help get you headed in the right direction:

for s in students:
    print( s )

Hint: look forward to learning about f-strings...

HTH,
Pierre


More information about the Python-list mailing list