Python Forum

Full Version: What's the difference b/w assigning start=None and start=" "
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If both empty strings and None are evaluated as FALSE,then:
start = None
   while start != "":
            start = (input("\nStart: "))
        
         if start:
            start = int(start)
 
            finish = int(input("Finish: "))
            print("word[", start, ":", finish, "] is", end=" ")
            print(word[start:finish])

    input("\n\nPress the enter key to exit.")
In the above code the while loop should evaluate to false and the loop should not be entered in the first place right? But if I run the program it runs fine.(this is a piece of code from Pizza slicer program from the book Python programming for absolute beginners).Where is my understanding messed up?
None, '', 0, 0.0, empty containers like list, tuple, dict, etc. will be evaluated as False
however None != "" is evaluated as True, because None and "" empty string are not the same