- 3
Password 🔑 validation
Sample Input: 2 Geek GfG1 Sample Output: NO YES Explanation: Test Case 1: It does not contain any numerical character. Test Case 2: The password is valid. For each test case ,print yes or no in a new line. To print 'Yes' Condition: password must contain one Upper and one lower case letter also a numerical character.
11 ответов
+ 4
Ravi Teja
Show whatever you have tried so we can where you are doing mistake.
+ 3
Mention language and show attempts
+ 1
n=int(input())
for i in range(n);
str=input()
if str.lower and str.upper in str:
print("Yes")
else:
print("No")
+ 1
Ravi Teja
You can count uppercase, lowercase, number using isupper(), islower(), isdigit() function
After counting check if all are greater than or equal to 1 like this
string = input()
c1 = 0
c2 = 0
c3 = 0
for i in string:
if i.islower():
c1 += 1
elif i.isupper():
c2 += 1
elif i.isdigit():
c3 += 1
if c1 >= 1 and c2 >= 1 and c3 >= 1:
print ("YES")
else:
print ("NO")
0
No of attempts
0
I tried a lot in many ways as much as I can but no result
0
I did every thing in compiler correctly,above all did dude
0
The code is also running successfully but,test cases not coming
0
When i did submit its showing wrong