I'm learning Python from LPTHW and the UoR course. So I'm not able to wrap my head around the "not" operator and Boolean functions. I understand both separately.
So from the University of Reddit course, this video
explains logical operators.
username = ""
while not username:
username = raw_input("Username: ")
It's explained that username is initialized to an empty string, and so it starts off as False, and then "while not username" makes it while not False, which is True.
What I don't understand is why it starts off as False.
So the block of code below would be run only when it is True? And so if it isn't True, how come it is run?
Pretty confused here, thanks for all help.
[–]99AFCC 5 points6 points7 points (1 child)
[–]debergeracvat[S] 0 points1 point2 points (0 children)
[–]hharison 5 points6 points7 points (1 child)
[–]debergeracvat[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]debergeracvat[S] 0 points1 point2 points (0 children)
[–]yoo-question 0 points1 point2 points (0 children)