Quote: I've created a list of numbers. I need to print 10 numbers per line, so they're all lined up one underneath the other. I'm having trouble trying to figure out how to remove the brackets [] and know how to print them lined up. Any advice welcome. Thanks!
def odd() : new_list = [] for i in range(1,50,2) : if i % 2 != 0 : new_list.append(i) for i in range(0, len(new_list), 10): print(new_list[i:i + 10]) odd()
Quote:my output:
[1, 3, 5, 7, 9, 11, 13, 15, 17, 19]
[21, 23, 25, 27, 29, 31, 33, 35, 37, 39]
[41, 43, 45, 47, 49]
Quote:EDITED: I've just realized I've gone about this all wrong. My final output should not include commas or brackets. I honestly have no idea how to fix this.![]()
Instead I should have:
1 3 5 7 9 11 13 15 17 19
21 23 25 27 29 31 33 35 37 39
With the values aligning on the right (can't get it to display properly here).