>_Code Club
← All exercises

python

Playing with text

Strings come with useful built-in tools, called methods:

word = "Python"

print(word.upper())      # PYTHON
print(word.lower())      # python
print(len(word))         # 6
print(word[0])           # P
print("th" in word)      # True

for letter in word:
    print(letter)

Your mission

  1. shout(text) returns the text in capital letters with ! at the end. shout("hello") returns "HELLO!".
  2. count_vowels(text) returns how many vowels (a e i o u) are in the text, uppercase or lowercase. count_vowels("Banana") returns 3.
Next exerciseDictionaries →
Loading the editor…