CBSE · 083Class XII · 2025Section C3 marks

Question 31

4 March 2025 · Computer Science (083)

Predict the output of the following code :

python
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")

Answer

The new string is: g0n2Ge