मराठी

Predict the output of the following code: def ExamOn (mystr): newstr = "" count = 0 for i in mystr: if count%2 != 0: newstr = newstr + str(count-1) else: newstr = newstr + i.lower() count +=1 newstr - Computer Science (Python)

Advertisements
Advertisements

प्रश्न

Predict the output of the following code:

def ExamOn (mystr):
    newstr = ""
    count = 0
    for i in mystr:
        if count%2 != 0:
              newstr=newstr+str(count-1)
       else:
            newstr=newstr+i.lower()
       count +=1
  newstr=newstr+mystr[:2]
  print("The new string is:", newstr)
ExamOn("GenX")
कोड लेखन
Advertisements

उत्तर

Output:"The new string is:g0n2Ge
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2024-2025 (March) Set 4

APPEARS IN

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×