for i in range(5):
print(i,end=',')
O/P : 0,1,2,3,4,
#I want to remove the comma after printing 4
CodePudding user response:
print(*range(5), sep=", ")
CodePudding user response:
It is not possible to remove the comma after it has been printed.
You could use ','.join([str(i) for i in range(5)])