Advertisements
Advertisements
प्रश्न
Predict the output of the code given below:
def makenew(mystr):
newstr.=.""
count=0
for i in mystr:
if count%2 ! = 0:
newstr=newstr+str(count)
else:
if i.lower():
newstr = newstr + i.upper ()
else:
newstr = newstr + i
count+=1
Print(newstr)
makenew("No@1") लघु उत्तर
Advertisements
उत्तर
N1@3
Explanation:
The function makenew() iterates through the characters in the provided string and generates a new string consisting of uppercases of the string characters and the values of a count or the original characters based on the values of the count and the cases of the characters in the string.
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
