if we test this codewe'll find that modifying notes doesn' work there are two bugsnamelythe notebook crashes when we enter note id that does not exist we should never trust our users to enter correct dataeven if we enter correct idit will crash because the note ids are integersbut our menu is passing string the latter bug can be solved by modifying the notebook class' _find_note method to compare the values using strings instead of the integers stored in the noteas followsdef _find_note(selfnote_id)'''locate the note with the given id ''for note in self notesif str(note id=str(note_id)return note return none we simply convert both the input (note_idand the note' id to strings before comparing them we could also convert the input to an integerbut then we' have trouble if the user had entered the letter "ainstead of the number " the problem with users entering note ids that don' exist can be fixed by changing the two modify methods on the notebook to check whether _find_note returned note or notlike thisdef modify_memo(selfnote_idmemo)'''find the note with the given id and change its memo to the given value ''note self _find_note(note_idif notenote memo memo return true return false this method has been updated to return true or falsedepending on whether note has been found the menu could use this return value to display an error if the user entered an invalid note this code is bit unwieldy thoughit would look bit better if it raised an exception instead we'll cover those in expecting the unexpected