wellclearlywe might want to do things with characterssuch as delete or copy thembut those are things that need to be handled at the document levelsince they are really modifying the list of characters are there things that need to be done to individual charactersactuallynow that we're thinking about what character class actually is what is itwould it be safe to say that character class is stringmaybe we should use an inheritance relationship herethen we can take advantage of the numerous methods that str instances come with what sorts of methods are we talking aboutthere' startswithstripfindlowerand many more most of these methods expect to be working on strings that contain more than one character in contrastif character were to subclass strwe' probably be wise to override __init__ to raise an exception if multi-character string were supplied since all those methods we' get for free wouldn' really apply to our character classit seems we needn' use inheritanceafter all this brings us back to our original questionshould character even be classthere is very important special method on the object class that we can take advantage of to represent our characters this methodcalled __str__ (two underscoreslike __init__)is used in string manipulation functions like print and the str constructor to convert any class to string the default implementation does some boring stuff like printing the name of the module and class and its address in memory but if we override itwe can make it print whatever we like for our implementationwe could make it prefix characters with special characters to represent whether they are bolditalicor underlined sowe will create class to represent characterand here it isclass characterdef __init__(selfcharacterbold=falseitalic=falseunderline=false)assert len(character= self character character self bold bold self italic italic self underline underline def __str__(self)bold "*if self bold else 'italic "/if self italic else 'underline "_if self underline else 'return bold italic underline self character