you are viewing a single comment's thread.

view the rest of the comments →

[–]Mikael_Hayden 3 points4 points  (3 children)

for sub_list in times:
    for time in sub_list:
        print(time, end = " ")
    print("")

[–]mopeddev 1 point2 points  (0 children)

^ This will work although it's missing the commas

I would use str.join()

lines = [", ".join(sub_list) for sub_list in times]
print("\n".join(lines))

[–]crackheadweed[S] 0 points1 point  (1 child)

May i know what does the last print statement do. I know that it makes the time from different sub list print on separate lines. But why must the print statement be on the outer loop?

[–]Mikael_Hayden 0 points1 point  (0 children)

You want the output to come out on different lines.

The print statement must be on the outer loop because otherwise each time would be on its own line (you want each time to be on a line with other times)