Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
beginner questions
#1
hello, i have to create a code that makes a user input a password that have at least 10 "symbols", have 1 uppercase , one lowercase , and one digit
i statrted coding 1 week and i still haven't grasp the fundamentals Cry
can you help me please?

x = input("please enter your password: ")
userpassword = [x]
for i in userpassword[0]:
    if len(userpassword[0]) < 10:
        raise Exception("password must have at least 10 characters")
    elif not userpassword[0].isdigit():
        raise Exception("password must have at least 1 digit")
    elif not userpassword[0].islower():
        raise Exception("password must have at least one lowercase letter in it ")
    elif not userpassword[0].isupper():
        raise Exception("pass words must have at least one uppercase letter in it")
Output:
please enter your password: cecerceercrecer5cerercercer Traceback (most recent call last): File "D:/Python/Medi/Medi.py", line 6, in <module> raise Exception("password must have at least 1 digit") Exception: password must have at least 1 digit
thank you! Big Grin
Reply


Messages In This Thread
beginner questions - by Naito - Jan-18-2019, 10:46 AM
RE: beginner questions - by perfringo - Jan-18-2019, 11:13 AM
RE: beginner questions - by buran - Jan-18-2019, 11:14 AM
RE: beginner questions - by ODIS - Jan-18-2019, 11:15 AM
RE: beginner questions - by perfringo - Jan-18-2019, 11:49 AM
RE: beginner questions - by aakashjha001 - Jan-27-2019, 05:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Beginner class. Need help with some questions. Willing to pay curtice 1 2,260 Mar-09-2018, 06:26 AM
Last Post: j.crater

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020