[SOLVED]C#: Password Rules | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

[SOLVED]C#: Password Rules

Updated: Solved. See link for solution. I am having a difficult time figuring this out. It should be correct, but one of the hidden cases is failing and I don't know why. https://code.sololearn.com/ca34E9MTPFqi/?ref=app

30th Dec 2020, 5:07 PM
Chris
Chris - avatar
11 Answers
+ 1
TheWh¡teCat 🇧🇬 please disregard. I solved it. I was missing a break statement, so I figured out that the hidden case had multiple invalid symbols. I can label this as solved now. Updated code will be public for all to see.
30th Dec 2020, 5:27 PM
Chris
Chris - avatar
+ 1
Chris , in fact I didn't do anything. The second thing I was considering was that with many disallowed symbols it will print many times "Invalid".
30th Dec 2020, 5:33 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
That's exactly what was happening. I didn't realize this at first because the one failed case was hidden.
30th Dec 2020, 5:36 PM
Chris
Chris - avatar
0
Chris , provide the full description of the task also exapmple inputs and outputs.
30th Dec 2020, 5:11 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
Write a program to take the password as input and output "Invalid", if it contains any disallowed symbols. If the password requirement is satisfied, program shouldn't output anything. Sample Input yl1893!dm$ Sample Output Invalid
30th Dec 2020, 5:21 PM
Chris
Chris - avatar
0
I cannot tell you the case that is failing because it is hidden. C# 47.2 Practice
30th Dec 2020, 5:22 PM
Chris
Chris - avatar
0
Chris , is it mentioned the full list of the symbols in the task? It's hard to compare them with this in your code.
30th Dec 2020, 5:27 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
Yes. The full list of symbols were the ones listed in my code. In any event, it is solved now. Thank you so much for taking a look, though!
30th Dec 2020, 5:30 PM
Chris
Chris - avatar
0
cheers for this chris. i was struggling with this one myself. turns out my issue was i was trying to use the line if (password.Contains(notAllowedSymbols)) rather than if (password.Contains(i)) as in your example.
20th May 2021, 5:36 AM
Andrew Hall
Andrew Hall - avatar