I am testing out some basic Object Oriented Programming in Python. The basics:
-User enters a name -While loop with a sentinel value of "quit" will continue entering names until the sentinel value is reached -The object is created with the inputted value (NAME and until a sentinel value is entered) -the object is then printed out using the constructor __str__ In my solution ( I am saying this because someone might have a work around that doesn't include the following below) -I want to use __init__ -I want to use __str__ -I want to use a while loop with a sentinel value EXPLANATION: I want to have the user enter in their NAME using a while loop, with "quit" being the sentinel value that breaks the loop. Once the name is entered, an object is created and it is passed into a constructor def __ini__ (self, name) and then I have them return a string value using __str__ for the name entered. The issue I am having is that when i enter the sentinel value of QUIT, it gets initialized as the name and printed out. How can I get around this? I hope this makes sense. -- https://mail.python.org/mailman/listinfo/python-list