Check sibling questions

Write a program that reads a string and then prints a string that capitalizes every other letter in the string, for example computer becomes cOmPuTeR.



Untitled 30.jpg


str=input( "Enter a string: " )


str2= ""

for i in range( 0 ,l):

    if i% 2 == 0 :

        str2 = str2+str[i]


        str2 = str2+str[i].upper()

print("New string: "+str2)



upper( ) is an in-built method used to convert lowercase letters to uppercase.

Learn in your speed, with individual attention - Teachoo Maths 1-on-1 Class

Ask a doubt
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 13 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.