Capitalize a word
.capitalize()
will convert the first letter in a string to uppercase.
.title()
will convert the first letter of each word in a string to uppercase.
Solution
# Bicycle - using .capitalize()
print('bicycle'.capitalize()))
# Guitar - using .title()
print('guitar'.title())
Display a word in all capital letters and all lowercase letters
.upper()
will convert all letters in a string to uppercase.
.lower()
will convert all letters in a string to lowercase.
Solution
# word: vIoLiN
print('vIoLiN'.upper() + ' ' + vIoLiN.lower())
Solution
Exchange all instances of a letter within a word with a different
The string method .replace(old, new)
will replace the old
character with the new
character.
# Mizzizzippi
print('Mississippi'.replace('s','z'))