Computer Science, asked by 1722, 1 year ago

write a python program that reads a string and then prints a string that capitalizes every other letter in the string .
eg. Passion becomes pAsSiOn


1722: kya laga bataa
shardul1925: chod usko...yun hi ganna suni ho..mohit ka...uska starting line accha hain
1722: bta phle wo ye lga na ki mai deti hungi galiyan
shardul1925: naa naa..uska ulta..
1722: yun hi to whi hai kitne dafe dil ne kaha dil ki suni kitne dafe
kal bhi to bheja tha lyrics iska ....tab bhi bola tha acha song hai
topic bhi change krna ni ata tujeh to pagal hhahhaha
1722: mujhe dete honge log galiyan ?
shardul1925: ladle tumko aur dusri ladkiyon ko galli dete hain...waise ye abnormal hain...jo ladki nahi patthi usko sab ra*** kehte hain... ye ganana hain..dtis
1722: i know .
betiyan na palte betiyon ko marte ladkiyan pata ke unko bandi bolte hain
aur jo raazi na ho unko sale r***** bolte hain
1722: my fav song of raftaar
1722: are schul me sab ek dusre ko dtee hai .....lekin mujhe mere frnds mtlb mere frnd circle me koi ni deta

Answers

Answered by shardul1925
3

Here is ur answer mate:

def foo(s):

ret = ""

i = True # capitalize

for char in s:

if i:

ret += char.upper()

else:

ret += char.lower()

if char != ' ':

i = not i

return ret

>>> print foo("hello world")

HeLlO wOrLd'


1722: 04
1722: 03
1722: 02
1722: 01
shardul1925: 1925
1722: byeee.........1925 kya
shardul1925: 19255
1722: aye hayee pagal
shardul1925: mera favourite number..
1722: wese ye 1925 ke piche ka raaz nhi jana kabhi
Answered by hafjsjebsv
2

Here is ur answer mate:

def foo(s):

ret = ""

i = True # capitalize

for char in s:

if i:

ret += char.upper()

else:

ret += char.lower()

if char != ' ':

i = not i

return ret


hsioedge: hmm2
17kat: ;)
hsioedge: hmm3
17kat: maine msg kr diya insta pr
hsioedge: hmm4
hsioedge: no.u do not done tht.
hsioedge: koi message nahi he
17kat: abe yrr ek notification hogi upr right me corner me request ayi hogi msgs me hi
17kat: jahan msg hote hai wahan dekh
hsioedge: mujhe nahi mil raha hain.
Similar questions