working code for Interactive Programming in Python class