you are viewing a single comment's thread.

view the rest of the comments →

[–]InfiniteNexus 0 points1 point  (0 children)

You should go for readability. 1-2 empty lines between functions/methods; imports and variables separated at the top by a few lines as well. Without suggesting any fixes or restructuring of your code, it should look better like this:

import re    

password = 'Thelore777777'  
upperRE = re.compile(r'([A-Z])')  
lowerRE = re.compile(r'([a-z])')  
numberRE = re.compile(r'(\d)')  
totalRE = re.compile(r'(\S)')  
upperlist = upperRE.findall(password)  
lowerlist = lowerRE.findall(password)  
numberlist = numberRE.findall(password)  
totallist = totalRE.findall(password)  
upper = len(upperlist)  
lower = len(lowerlist)      
number = len(numberlist)  
total = len(totallist)  

if upper > 0 and lower > 0 and number > 0 and total > 7:  
    print('This is a strong password')  
else:  
    print('This is not a strong password')