A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

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:"

  • This Question is Closed
  1. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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()

  2. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

  3. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

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

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.