Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8166947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:03:24+00:00 2026-06-06T20:03:24+00:00

I made a program in Idle that says: for trial in range(3): if input(‘Password:’)

  • 0

I made a program in Idle that says:

for trial in range(3):
if input('Password:') == 'password':
    break
else:
    # didn't find password after 3 attempts
    **I need a stop program here**
print ("Welcome in")

Remember, this is in Idle, so I need program for Idle, not CMD. I also am using Python 3.2, if that helps.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T20:03:26+00:00Added an answer on June 6, 2026 at 8:03 pm

    use sys.exit() or raise SystemExit

    import sys
    for trial in range(3):
        if input('Password:') == 'password':
            break
    else:
        sys.exit()
    print ("Welcome in"))
    

    Edit:
    To end it silently wrap it in a try-except block:

    try:
        import sys
        for trial in range(1):
            if raw_input('Password:') == 'password':
                break
        else:
            raise SystemExit #or just sys.exit()
        print ("Welcome in")
    except SystemExit:
        pass  #when the program throws SysExit do nothing here,i.e end silently
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i made a program that search logical drives to find a specific file .if
I made a program that asks for input and returns a value. After, I
I made a program that opens an application, sleeps the thread for 500ms then
I made a program: import collections x = input(Enter in text: ) x_counter =
So I made a program that uses four differrent processes to do some stuff.
I have made a program that scans rss feeds. This same program creates feeds
I am writing a program to find adapters, and have made a class called
I made a program that returns the sum of all primes under 2 million.
I made a program that returns the product a b c where a,b,c are
I made a program in Xcode, being a simple calculator that takes a first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.