Three string methods are used on a word with mixed capitals, and a function counts the capitals. def caps(s): return sum(ch.isupper() for ch in s) word = "hELLO wORLD" word.swapcase() print(caps(word), caps(word.capitalize()), caps(word.title())) What does the program print?
Log in to join the discussion.
Loading…