Programming Examples

Python program input string and prints its characters in different lines two characters per line


Write a python script that traverses through an input string and prints its characters in different lines – two characters per line.

Solution

s=input("Enter a String")
l=len(s)
j=0
for i in range(0,1):
    print(s[i],end='')
    j+=1
    if j%2==0:
        print('')
▶ RUN

Output/ Explanation:

Enter a String  infomaxacademy

in

fo

ma

xa

ca

de

my

Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad