In: Computer Science
I'm making a python program that checks the users input. If the users input does not match the rules then the program will output "No".
If the users input does match the rules it will output "Yes".
The rules are :
at least 5 uppercase letters
at least 5 lowercase letters
at least 5 numbers
No more than 20 characters in total
I have managed to meet these conditions in individual python files but not in one. Ideally without importing anything, still learning the basics as you can see! Thanks
Python 3 code
============================================================================================
s=input('Enter input: ')
length=len(s)
flag=0
countlower=0
countupper=0
countdigit=0
if length<=20:
for i in s:
if(i.islower()):
countlower=countlower+1
elif(i.isupper()):
countupper=countupper+1
elif(i.isdigit()):
countdigit=countdigit+1
if(countlower<5 or countupper<5 or countdigit<5):
flag=0
else:
flag=1
else:
flag=0
if flag==0:
print('No')
else:
print('Yes')
============================================================================================
Output