SolveItNCERT · CBSE Boards

CBSE 2026 · Central · Set 4 · Q26 · 2 marks

The function given below is written to accept a string $\displaystyle \mathbf{s}$ as a parameter and return the number of vowels appearing in the string. The code has certain errors. Observe the code carefully and rewrite it after removing all the logical and syntax errors. Underline all the corrections made.
def CountVowels(s):
    c=0
    for ch in range(s):
        if 'aeiouAEIOU' in ch:
            c=+1
    return(ch)

FunctionsUser Defined FunctionsApplyvery_short_answer

More from Functions

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