I want to remove the ',' before the '<', and the last ',' that is being printed, but I'm not sure how.
It's like I'm repeating a print command, but I'd like the last element being printed to follow a different command.
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
for i in a:
if i < 5:
print(i, end=' ,')
print('<', end=' ')
for i in a:
if i > 5:
print(i, end=' ,')
This is what is being printed:
1 ,1 ,2 ,3 ,< 8 ,13 ,21 ,34 ,55 ,89 ,
I want to remove those extra commas.