list = [1, 2, 3, 4]
for element in list:
print(element, end=" ")
For this code, the output is: 1 2 3 4 . But there is a space after the last element(4).How can I remove only that last space?I tried adding sep=" " before the end=" " but it doesn't work.