anonymous
  • 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:"
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • 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()
anonymous
  • 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.
anonymous
  • 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.

Looking for something else?

Not the answer you are looking for? Search for more explanations.