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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
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
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
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: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 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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Random Class and its operations
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education