We have just some string methods, a special type of function that can "owned" by a string. The ones that we learned about are:
s.isalpha() - Returns True if all the characters in s are letters. s.isdigit() - Returns True if all the characters in s are digits. s.isupper() - Returns True if all the letters in s are capital letters. s.islower() - Returns True if all the letters in s are lower-case letters. s.istitle() - Returns True if the first letter of every word is capitalized and every other letter is lower case.
s.upper() - Returns a string with s’s contents in upper case. s.lower() - Returns a string with s’s contents in lower case. s.swapcase() - Returns a string with s’s contents in converted from upper to lower case, and from lower to upper case. s.capitalize() - Returns a string with s’s letters in lower case, except for the first character if it is a letter. s.title() – Returns a string with the first letter in s’s words in upper case, the rest in lower case. Given
s = "It is imperative that we do that which is right"
t = "THE YANKEES STINK!!!"
u = "The Taming of the Shrew"
v = "3.14159"
Evaluate
s.isalpha() u = u.lower() s.isdigit() u = u.swapcase() s.istitle() t = t.lower() s.islower() u = u.capitalize() t.isupper() t = t.title() t.isalpha() u.istitle()