Hey @abhijmr.143, you can print array integers in the format mentioned in your question with the following code:
Code:
from __future__ import print_function
a = [1,2,3,4,5]
for value in a:
print(value, end=',')
print("\b",end="")
print(" ")
Output:
1,2,3,4,5
Explanation:
from __future__ import print_function #This line is only needed in Python 2.X, you can skip this line if you are using python 3.X
a = [1,2,3,4,5] #array initialization
for value in a: #loop to print all array elements
print(value, end=',') #This line prints the array integers with a comma(,) as its suffix and prints a comma even after the last integer
print("\b",end="") #This line is used to move the cursor to the last printed character
print(" ") #This line replaces the comma(,) printed after the last integer with a blank space