On 06/24/2013 08:20 AM, Lutz Horn wrote:
Hi,

Am 24.06.2013 14:12 schrieb christheco...@gmail.com:
username=raw_input("Please enter your username: ")
password=raw_input("Please enter your password: ")
if username == "john doe" and password == "fopwpo":
     print "Login Successful"
else:
     print "Please try again"

while not username or not password or username != "john doe" or password
!= "fopwpo":
     print "Please try again"
     username=raw_input("Please enter your username: ")
     password=raw_input("Please enter your password: ")

print "Login Successful"



That requires you to have four raw_input() calls instead of two. And what purpose does adding the two new clauses to the while test serve? How is:

while not username or not password or username != "john doe" or password != "fopwpo":

different from:

while username != "john doe" or password != "fopwpo":

(other than taking more time and space, and being harder to read) ?

--
DaveA
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to