Back

Print the characters in a string separated by Comma

Created 1 year ago
493 Views
4 Comments
Gayathiri02
@Gayathiri02
Gayathiri02
@Gayathiri02Profile is locked. Login

If a word is entered I have to separate each letters using comma. I have attached my code below, where the output is print in each line but not in single line. Can you please correct me what is the mistake in the code. Thanks.

Input : guvi

Output : g,u,v,i

txt = input()
a = len(txt)
for i in range(a):
 print(txt[i]+","+"")
Comments (4)
Please login to comment.