1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Aleonysh [2.5K]
3 years ago
8

Python Better Password Prompt

Computers and Technology
1 answer:
faust18 [17]3 years ago
3 0

We use an indefinite while loop to keep the user entering the password. In the loop, we use if-else structure to check the password. If it is "abc123", the password is found and stop the loop using a break. Otherwise, the password is not correct. Note that since we do not use any break statement in the else part, the loop will continue asking for the input

Comments are used to explain each line of the code.

You may see the output in the attachment.

#set the SECRET

SECRET = "abc123"

#create a loop

while True:

   

   #ask the user to enter a password

   password = input("Enter password: ")

   

   #check if the password is equal to SECRET

   # if it is, state that password is correct and stop the loop using a break

   # otherwise, state that password is not correct

   if password == SECRET:

       print("You got it!")

       break

   else:

       print("Sorry, that did not match. Please try again.")

Here is another question related to the loops:

brainly.com/question/25694810

You might be interested in
The following is the correct way to write a for loop
Rzqust [24]

Answer:

for i in range

Explanation:

This is the only excerpt of code

3 0
3 years ago
If your body were a house, your skeleton would be the house's ___________.
frozen [14]
I think the answer is c wooden frame
3 0
3 years ago
Read 2 more answers
4:when a computer is on it is
Tanzania [10]

Answer:

c: running

Explanation:

when the computer is turned on The operating system keeps things organized in the background so that multiple programs can run at the same time

4 0
2 years ago
Document could not be saved bad file handle
creativ13 [48]
To help fix this problem try reviewing the file and opening it on your own when your sure its good on your side then try to save it if all else fails make a new one
8 0
4 years ago
In the context of a global information system (gis), _____ offer electronic data interchange standards, encryption, secure e-mai
11Alexandr11 [23.1K]
Answer is (B) Value-added networks.

A van is a private network provider hired among online companies that facilitate EDI (Electronic Data Interchange) or other network services such as message encryption, securing mail, and management reporting. A Value Added Network provides an easy way for ecommerce businesses to share data and communicate securely.






8 0
4 years ago
Other questions:
  • What is the difference between a denial-of-service attack and a distributed denial-of-service attacks? which is potentially more
    10·1 answer
  • How can you create balance to your drawing using only grayscale values?
    12·1 answer
  • Which answer best describes an unsubsidized federal loan
    13·1 answer
  • Some careers emerge to address the environmental impact human behaviors and processes might be having on our planet. True False
    9·2 answers
  • A web designer calls to report that the web server web-s1.cisco is not reachable through a web browser. The technician uses comm
    6·1 answer
  • What are three attributes of the input tag
    5·1 answer
  • You have enabled IP routing on PLABSA01 after enabling the IPRouter in the registry. How will you verify whether the IP routing
    7·1 answer
  • Using the simple alphabet code below, you will decode and encode the message. Write the Full
    6·1 answer
  • How do I fix this stylesheet?
    14·1 answer
  • What command can you use if you accidentally delete a sentence in your document?
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!