Instruction
You did well! Some other popular is-functions available in Python are:
str.isalpha()– returnsTrueif all characters in the string are letters.str.isalnum()– returnsTrueif all characters in the string are letters or digits.str.isspace()– returnsTrueif all characters in the string are whitespaces.str.islower()andstr.isupper()– returnTrueif all characters in the string are lowercase/uppercase.
Let's do one more exercise with is-functions.
Exercise
John's calculations regarding translation prices have become more complicated. He is now paid the following:
- $
0.03for each letter. - $
0.02for each digit. - $
0.01for each whitespace character.
Modify the application so that it calculates the correct price. Print a single sentence:
The price is ${x}.
Stuck? Here's a hint!
Create three counters: one for letters, one for digits, and one for white spaces. Use the isdigit(), isalpha(), and isspace() functions.



