You have an error in your indentation here as @Abhishek mentioned. But the reason why your while loop is not breaking is because of the line of code where you do
if new_item.lower == 'start':
@Abhishek has also pointed this out in his code sample but I will elaborate a little more
, Here new_item.lower is a function object but you are not running that function. To actually run the function you have to use
if new_item.lower() == 'start:
this converts the new_item
string into all lower case as you are trying to do here. Just new_item.lower
is just a pointer to the function. If you actually print out new_item.lower
you can see that it shows something like <built-in method lower of str object at 0x7f5144522cb0>
which is telling you that it is a function at the said memory location. So in your line you are comparing whether a function is equal to the string 'start'
where what you actually want to do is to see whether the result of the function acting on new_line is equal to the string 'start'
.