Python Forum
Symbols Distinguished From Letters?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Symbols Distinguished From Letters?
#1
Hi, I'm creating a password score program, everything seems to be fine until you enter a password with only symbols. It comes out saying that both upper and lower case letters were used. I need a way to distinguish symbols from upper and lower case letters.

#This program allows the user to see how good the security of his password is based on a point system.
pts = 0

print ("Hello! Welcome to the Password Score Calculator!")

name = input ("What is your name? ")

PW1 = input ("What is your password? ")

PW2 = input ("Please type it again to secure a match. ")

while PW2 != PW1:
    PW1 = input ("Unfortunately,they did not match. Please re-enter your password. ")

    PW2 = input ("Please type it again to secure a match. ")
if PW2 == PW1:
    print ("Secured.")

if len(PW1) >= 8:
    print ("+5 Points")
    pts += 5

if PW1.isupper():
    print ("Please use lowercase and uppercase letters.")
elif PW1.islower():
    print ("Please use lowercase and uppercase letters.")
else:
    print ("+10 Points")
    pts += 10

import re

if any (PW1.isdigit()for PW1 in PW1):
    print ("+10 Points")
    pts += 10

symbols = "~`!@#$%^&*()/_-+={}[]:>;',</?*-+"

contains_symbol = False
for symbols in symbols:
    if symbols in PW1:
        contains_symbol = True
        pts += 5
        print ("+5 Points")
        break
Reply


Messages In This Thread
Symbols Distinguished From Letters? - by MeMeBigBoy - Apr-05-2017, 10:46 AM
RE: Symbols Distinguished From Letters? - by Ollie - Apr-05-2017, 10:50 AM
RE: Symbols Distinguished From Letters? - by wavic - Apr-05-2017, 12:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python script that deletes symbols in plain text nzcan 3 721 Sep-05-2023, 04:03 PM
Last Post: deanhystad
  cyrillic symbols in tables in reportlab. hiroz 5 11,622 Sep-10-2020, 04:57 AM
Last Post: bradmalcom
  Unexpected output: symbols for derivative not being displayed saucerdesigner 0 2,089 Jun-22-2020, 10:06 PM
Last Post: saucerdesigner
  Replacing symbols by " Tiihu 1 1,913 Feb-13-2020, 09:27 PM
Last Post: Larz60+
  How do I delete symbols in a list of strings? Than999 1 2,316 Nov-16-2019, 09:37 PM
Last Post: ibreeden
  Python symbols AND letters gullidog 1 3,524 Apr-05-2017, 10:13 PM
Last Post: ichabod801
  Strings containing both symbols and letters gullidog 13 8,344 Apr-05-2017, 12:27 PM
Last Post: ankit
  Symbols in a String MeMeBigBoy 4 4,353 Apr-05-2017, 11:21 AM
Last Post: garfield
  How to get pyhton to identify symbols in a string MemeLord15 4 4,385 Apr-05-2017, 11:14 AM
Last Post: wavic

Forum Jump:

User Panel Messages

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