Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 21 Online
OpenStudy (anonymous):

This is an exercise on one of the readings. def password(): n=0 a=str(raw_input("Password:")) b="bob123" if a==b: print "You have successfully logged in" n=0 exit() else: n+1 print "Sorry your password was wrong" if n==3: print "You have been denied access" exit() password() all i wanna know is how do i get it to not print the blank space(runtime error) before the raw_input/"password:"

OpenStudy (anonymous):

I figured it out my ordering was wrong if someone knows why the order changed this please explain. I know it fixed it but I still don't understand why? def password(): n=0 while n<3: a=str(raw_input("Password:")) b="bob123" if a==b: print "You have successfully logged in" n=0 exit() else: n=n+1 print "Sorry your password was wrong" if n==3: print "You have been denied access" exit() password()

OpenStudy (anonymous):

I'm not sure what you're asking here. There's nothing in the first example that would cause it to print a 'blank space'. The only difference is that one uses a while loop to only allow 3 errrors and the first example does not.

OpenStudy (anonymous):

What the heck i ran it severely times yesterday and it kept printing a blank input space before it said 'password:' but now when i try it it's working fine. Thanks anyway.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Nina001: bug
7 minutes ago 5 Replies 0 Medals
XShawtyX: Art, give me more to add to this
17 minutes ago 61 Replies 2 Medals
CecePitbull: Who wants to debate about Trump I think he's horrible who doesn't.
15 minutes ago 5 Replies 2 Medals
cinna: Who is good with photo editing? Dm me pls
8 hours ago 2 Replies 0 Medals
CecePitbull: guess who made no kings protest signsud83eudd2d
9 hours ago 3 Replies 0 Medals
danielfootball123: Question.... How much is questioncove worth if I were to buy it?
7 hours ago 8 Replies 1 Medal
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!