Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Code in Python coding language: Having a secured password is a very important pr

ID: 3807154 • Letter: C

Question

Code in Python coding language:

Having a secured password is a very important practice, when much of our information is stored online. Write a program that validates a new password, following these rules:

The password must be at least 8 characters long.

The password must have atleast one uppercase and one lower case letter.

The password must have atleast one digit.

Write a program that asks for a password, then asks again to confirm it. If the passwords don’t match or the rules are not fulfilled, prompt again. Your program should include a function that checks whether a password is valid.

Explanation / Answer

import re

x = True
while x:
p= input("Input your password: ")
rp= input("Re-Enter your password: ")
print(p==rp)
if p != rp:
print("password and reEntered passwords are different")
elif (len(p)<8):
x=True
elif not re.search("[a-z]",p):
x=True
elif not re.search("[0-9]",p):
x=True
elif not re.search("[A-Z]",p):
x=True
else:
print("Valid Password")
x=False
break
if x:
print("Not a Valid Password")

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote