Basic (2)

You have to program several functions. In each case, few lines of code
are enough.

1.  Write a function @vowel_consonant(s)@ that given an string s returns
    the number of vowels and consonants that appear as characters in s.
    We assume all characters of s are letters.

2.  Write a function @delete_digits(s)@ that returns the string obtained
    after ruling out the digit characters of s.

3.  Write a function @switch(s)@ that given an string s returns the
    string obtained after switching lowercase to uppercase letters and
    the other way around. Non letter characters do not change. Warning:
    do not use the @swapcase@ string method.

4.  Write a function @countdown(n)@ that given an integer n greater than
    zero prints the count down until 0.

5.  Write a function @powers_of_2(n)@ that given a natural n prints the
    n first powers of 2.

Scoring

Every function counts 20 points.

Sample session

Problem information

Author: Jorge Castro

Generation: 2026-01-25T10:26:46.310Z

© Jutge.org, 2006–2026.
https://jutge.org
