+ 5
Again. I can't find the bug 👇😔 pasword validation
cl = ['!', '@', '#', '
#x27;, '%', '&', '*'] num = ["1","2","3","4","5","6","7","8","9","0" ] ab = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"] pw = input() m = 0 n = 0 abc = 0 for i in pw : if i in cl: m += 1 elif i in num : n += 1 elif i in ab : abc += 1 pr = True kr = True if abc >= 7 : pr = False kr = False if m < 2 : pr = True if n<2 : kr = True if pr or kr : print("Weak") if not pr and not kr : print("Strong")19 Respostas
+ 8
Yes, that's what I'm trying to explain: By "characters" they don't mean number of of alphabetic characters. I think they mean total length of the string
+ 6
Is it the code coach task?
I looked at the instruction text. Maybe min. 7 characters does not mean 7 alphabetic characters but rather a total length of 7?
+ 6
Great 👍
+ 5
Amit Ranjan Sahoo Here's a one-liner possibility:
print(("Weak", "Strong")[len(k := input()) > 7 and sum(x.isdigit() for x in k) > 1 and sum(x in "!@#$%&*" for x in k) > 1])
# Hope this helps
+ 4
Can you please but your code in a playground script and then link it here?
+ 4
Lisa
Ok, here it is 👇
https://code.sololearn.com/cQ2gkmtWBS2o/?ref=app
+ 4
Lisa
Yes, i did that befor
But now i tried all the charecter of my keyboard 👇👇
+ 2
Lisa
Yes its cod coach task.
Oooo, i listed alphabets🙁
+ 2
I just tried the task: It seems it is not required that the pw has 7 abc... It's enough if len(pw) >=7
+ 2
I would advise you to use regex for this problem.
+ 1
What I meant is the following:
pw = "12abc*** should be strong, too, because len(pw) >= 7 although it only has abc as alphabetic characters
+ 1
Lisa
Hmm, i tried this ,but anathor bug obtained 👇👇
if len(pw) >14
And
if len(pw) != 14
But it is not fully satisfy.
+ 1
Lisa
In
Pasword- 12abc*** the charecters are only 3(a,b,c)
+ 1
Lisa ,
Here "*" is a special charecter not only charecter.
+ 1
Lisa
Yaaa, i tried and get succes 😀❤️. Thank you very much 😄
+ 1
Calvin Thomas
Wow, you are pro-coder 😀👌🙏
+ 1
You are just counting alphabets that is greater than or equal to 7.
It must satisfy all 3 conditions properly to say it as strong else it is evaluated as weak.
Kindly make these changes 😀
0
You should probably considerate learning about regular expressions, it can make your life easier ;)