I am trying to create a Python definition to display a list and trying to add a feature where if the list is more than 10 it will display it horizontally.
Here's my code:
def print_vert_list(list):
index = 0
for i in list:
if len(list) > 10:
print (" ".join(list[index]) + " ".join(list[11:11+index])) + " ".join(list[21:21+index])
else:
print (" ".join(list[index]))
index += 1
And here's the log:
Traceback (most recent call last):
File "**********", line 30, in <module>
print_vert_list(file_var_list)
File "**********", line 22, in print_vert_list
print (" ".join(list[index]) + " ".join(list[11:11+index])) + " ".join(list[21:21+index])
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
If I understand correctly the question then this is a solution: