Is there a problem in line 2? | Sololearn: Learn to code for FREE!

-3

Is there a problem in line 2?

lower, upper, special, digit = 0, 0, 0, 0 password = input(str) if (len(password) >= 7): for i in password: if(word[0].isupper()): upper += 1 if(i.islower()): lower += 1 if(i.isdigit()): digit += 2 if(i == '@' or i == '$' or i == '_' or i == '#'): special += 1 else: print("Password should be more than 6 characters") if (lower >= 1 and upper >= 1 and special >= 1 and digit >= 1): print("Strong") else: print("Weak")

10/19/2021 7:41:06 PM

Tree

13 Answers

New Answer

+4

Yes, remove this 'str' to password = input()

+2

you can just use password = input() If you do not set it to lets say an integer like int(input()) it will automatically assume it is a string. Hope this helps!

+1

Yes, there must be also an other issue. But I'm not so fast 😉

+1

Coding Cat 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 ('!', '@', '#', '$', '%', '&', '*'), and a length of at least 7 characters. If the password passes the check, output 'Strong', else output 'Weak'.

+1

There are many issues. I'm on work

+1

Maybe this is better. DON'T DO MORE AS YOU HAVE TO DO! And for code coach, Do NOT make any outputs more as they ask for! https://code.sololearn.com/ciT2skV07385/?ref=app

+1

Now there are special characters missing. In the text above I see seven. But only four are checkt in your code.

+1

Very nice. Gern geschehen.

0

Coding Cat Thanks. I did it. The result must be "Strong" but now is "no Output"

0

Coding Cat thanks Coding Katze. What is wrong with this? https://code.sololearn.com/cPHFaacz5f25/?ref=app

0

Idk. Some broken spaces maybe from copy and paste. I've deleted this if sequence and have it rewritten. https://code.sololearn.com/cST08FWLjqIS/?ref=app

0

And the digits are now missing if(i.isdigit()): digit += 1

0

Danke sehr. It worked https://code.sololearn.com/cPHFaacz5f25/?ref=app