Write a program in Python that serves as a password checker. The string password that Python should check. for is, "wahtZ9t%". The program must limit the user to 3 password attempts. A loop controlled by the range function must be used to execute up to 3 times. If the user entered password matches the target then the computer should output a success message that includes the number of tries it took to get it right. Then the loop must exit. Otherwise display a failure message, including attempts left and return to top of loop. If the user fails all 3 attempts output a message that the users password has been revoked. Process: • Declare and set values for variables needed throughout the code o A string containing the "target" password: "wahtz9t%" o A limit for attempts at entering the password: 3 o A Boolean value to show if the user succeeded in entering the password (or not) • Create an iterative structure to execute up to 3 times: o Prompt the user for a password o If the entered password matches the "target": • Output a success message that includes the number of tries needed to get the password right Exit the loop ▪ o Otherwise: ▪ Output a failure message, including the number of attempts left Return to the top of the loop • If the user failed in three attempts to get the password: o Output a message that the user's password has been revoked

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter6: Arrays
Section: Chapter Questions
Problem 7RQ
icon
Related questions
Topic Video
Question
Write a program in Python that serves as a password checker. The string password that Python should check
for is, "wahtZ9t%". The program must limit the user to 3 password attempts. A loop controlled by the
range function must be used to execute up to 3 times. If the user entered password matches the target then
the computer should output a success message that includes the number of tries it took to get it right. Then
the loop must exit. Otherwise display a failure message, including attempts left and return to top of loop. If
the user fails all 3 attempts output a message that the users password has been revoked.
Process:
• Declare and set values for variables needed throughout the code
OA string containing the "target" password: "wahtZ9t%"
o A limit for attempts at entering the password: 3
o A Boolean value to show if the user succeeded in entering the password (or not)
• Create an iterative structure to execute up to 3 times:
.
o Prompt the user for a password
o
If the entered password matches the "target":
▪
Output a success message that includes the number of tries needed to get
the password right
Exit the loop
o Otherwise:
▪ Output a failure message, including the number of attempts left
Return to the top of the loop
If the user failed in three attempts to get the password:
o Output a message that the user's password has been revoked
Transcribed Image Text:Write a program in Python that serves as a password checker. The string password that Python should check for is, "wahtZ9t%". The program must limit the user to 3 password attempts. A loop controlled by the range function must be used to execute up to 3 times. If the user entered password matches the target then the computer should output a success message that includes the number of tries it took to get it right. Then the loop must exit. Otherwise display a failure message, including attempts left and return to top of loop. If the user fails all 3 attempts output a message that the users password has been revoked. Process: • Declare and set values for variables needed throughout the code OA string containing the "target" password: "wahtZ9t%" o A limit for attempts at entering the password: 3 o A Boolean value to show if the user succeeded in entering the password (or not) • Create an iterative structure to execute up to 3 times: . o Prompt the user for a password o If the entered password matches the "target": ▪ Output a success message that includes the number of tries needed to get the password right Exit the loop o Otherwise: ▪ Output a failure message, including the number of attempts left Return to the top of the loop If the user failed in three attempts to get the password: o Output a message that the user's password has been revoked
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage