I don't get KeyError when I use a constant (whose value is the same as the variable) for [key].
For example:
self._answer= input("Which appointment would you like to delete?")
self._useless= self._book.pop(self._answer)
Gives a key error when self._answer= 1001, however:
self._useless= self._book.pop(1001)
works as desired. Any ideas how I can resolve this issue?
Edit: As @user2357112 suggested below, the following piece of code worked: def deleteAppointment(self):
self._answer= int(input("Which appointment would you like to delete?"))
del self._book[self._answer]
However, after redoing the entire project I no longer ran into the problem above (i.e. using [dictionary].pop([key]) no longer produced a KeyError). Therefore, if you are getting this error there is likely a bug in your code.