print(i, end=" ") is what I'm using to print elements of an array in a single line. But in this case a space will be added even after the last element which in turn results in an error while executing the program(Testcase error) .So how to print elements without that error?