SolveIt is under development
SolveItNCERT · CBSE · NEET
Question 13 / 13 · latest first
✓ Board-verified
Computer Science · 2026 · 3 marks

CBSE 2026 · Central · Set 4 · Q31

(a) Write the output of the following code: def Exam2026(given): new=[] for ch in given[1:-1]: if ch.isupper(): new.reverse() elif ch not in new:…

(a)
Write the output of the following code :
def Exam2026(given) :
    new=[]
    for ch in given[1:-1]:
        if ch.isupper():
            new.reverse()
        elif ch not in new:
            new.append(ch)
        elif ch in new:
            new.pop()
    print(new)
Exam2026("Gold-24Medals")
(b)
Write the output of the following code :
def Exam2026(given):
    new = 0
    while given:
        if new % 2:
            new += given % 10
        else:
            new += given % 5
        print(new, end='-')
        given //= 10
Exam2026(123456)
ShareWhatsAppTelegram

More from Revision of Python

CBSE Class 12 Computer Science past-paper question from the 2026 board exam, with the answer as CBSE’s own marking scheme gives it. Where our answers come from.