+ 3

How to debug this?

Sololearn gives me a X in test case 13 which seems to be a hidden case. https://code.sololearn.com/cbVJPlN5s5Ty/?ref=app

11th Aug 2021, 3:21 AM
Abs Sh
Abs Sh - avatar
21 Antworten
0
Abs Sh It seems like my suspicion was right; itertools.groupby() is the culprit: https://code.sololearn.com/cRjwkxPHTN5p/?ref=app
11th Aug 2021, 6:15 AM
Calvin Thomas
Calvin Thomas - avatar
+ 2
Abs Sh How about using a random password generator to debug your code?
11th Aug 2021, 4:45 AM
Calvin Thomas
Calvin Thomas - avatar
+ 2
Here's a simpler version k = input() print("Strong" * (len(k) > 6 and sum(x.isdigit() for x in k) > 1 and sum(x in "!@#$%&*" for x in k) > 1) or "Weak") # Hope this helps
11th Aug 2021, 6:29 AM
Calvin Thomas
Calvin Thomas - avatar
12th Aug 2021, 7:44 PM
Tettey Kornyoh Eku
Tettey Kornyoh Eku - avatar
+ 1
11th Aug 2021, 10:19 AM
Abs Sh
Abs Sh - avatar
+ 1
Group by makes multiple list with same key so i should have sum all of it together i should admit though your code was much better https://code.sololearn.com/cHWDJnWxPGJR/?ref=app
11th Aug 2021, 10:31 AM
Abs Sh
Abs Sh - avatar
+ 1
I still don't understand why people love to make large codes instead of small ones. Is efficiency an advantage? Sometimes.
11th Aug 2021, 2:18 PM
Calvin Thomas
Calvin Thomas - avatar
+ 1
Try making the numbers 0-9 (including 9)
12th Aug 2021, 7:17 AM
Tettey Kornyoh Eku
Tettey Kornyoh Eku - avatar
0
You're interviewing to join a security team. They want to see you build a password evaluator for your technical interview to validate the input. Task: Write a program that takes in a string as input and evaluates it as a valid password. The password is valid if it has at a minimum 2 numbers, 2 of the following special characters ('!', '@', '#', '
#x27;, '%', '&', '*'), and a length of at least 7 characters. If the password passes the check, output 'Strong', else output 'Weak'. Input Format: A string representing the password to evaluate. Output Format: A string that says 'Strong' if the input meets the requirements, or 'Weak', if not. Sample Input: Hello@$World19 Sample Output: Strong
11th Aug 2021, 3:34 AM
Abs Sh
Abs Sh - avatar
0
The password should be "Strong" if its total lenght is at least 7 (including the special characters and the numbers)
11th Aug 2021, 4:01 AM
Angelo
Angelo - avatar
0
Angelo Yeah thats what i'm doing
11th Aug 2021, 4:24 AM
Abs Sh
Abs Sh - avatar
0
There doesn't seem to be a problem
11th Aug 2021, 5:12 AM
Abs Sh
Abs Sh - avatar
0
Maybe it wants exactly 2 special characters
11th Aug 2021, 5:45 AM
Angelo
Angelo - avatar
0
Angelo didn't work
11th Aug 2021, 5:47 AM
Abs Sh
Abs Sh - avatar
0
Abs Sh Oh, I had thought that groupby gives the result in a single step.
11th Aug 2021, 10:38 AM
Calvin Thomas
Calvin Thomas - avatar
0
It was my first time using it as well just passed it once in docs
11th Aug 2021, 10:40 AM
Abs Sh
Abs Sh - avatar
0
What about this code ? https://code.sololearn.com/cxK47lZE4kE7/?ref=app anything can be helpful because i'm just a beginner
11th Aug 2021, 12:21 PM
Anas Kebir
12th Aug 2021, 4:11 PM
Jobless
Jobless - avatar
0
Sully Bakz Take an axe and start hacking down small trees. You'll eventually succeed... as a hacker and as well as a mass-deforestation creator.
12th Aug 2021, 6:51 PM
Calvin Thomas
Calvin Thomas - avatar
0
how about this? https://code.sololearn.com/cx4fiETS9QIS/?ref=app It managed to pass the test, and did not require complicated solutions Remember the zen of Python.
13th Aug 2021, 2:43 AM
Bob_Li
Bob_Li - avatar