[SOLVED] Password Validation (Swift) Code Coach Problem | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 9

[SOLVED] Password Validation (Swift) Code Coach Problem

I am getting 6/13 test cases failed. Why?? What's wrong?? Question https://www.sololearn.com/coach/76?ref=app My Solution https://code.sololearn.com/c85zoCtmG0D6/?ref=app

22nd Jul 2020, 7:15 PM
Aditya Raj
Aditya Raj - avatar
3 ответов
+ 15
First of all read inputs var inputS = readLine()! Good check if inputArr.count < 7 { result = false } Here use && (and) not || (or) if result { if resNumbers > 1 && resSpecial > 1 { result = true }/*if not meet re assign result or it will be same (true)*/ else{result = false} }
22nd Jul 2020, 7:28 PM
᮴Ridwan_
᮴Ridwan_ - avatar
+ 6
Thank you so much ᮴Ridwan it is solved now ☺️😊☺️😊
22nd Jul 2020, 7:39 PM
Aditya Raj
Aditya Raj - avatar
+ 1
The problem requires that both, numbers AND special characters occur at least in the specified number. You check if either one or the other condition is fulfilled.
22nd Jul 2020, 7:29 PM
Sandra Meyer
Sandra Meyer - avatar