0
Hidden test problem C# lesson 47.1
Hi, i was doing practice where you have to check if password contains any of not allowed characters, and i passed all tests besides a 4th hidden test. I have used the for loop and a.Contains method. C# lesson 47.1 practice 4th hidden test trouble.
4 Answers
+ 2
Change the condition inside loop body to check whether <notAllowedSymbols> contains <password>[x] instead.
+ 2
01:06 auuu please can you link the code instead of posting to the forum
+ 1
Ipang thank you
Ananiya Jemberu ok
0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace SoloLearn
{
class Program
{
static void Main(string[] args)
{
string password = Console.ReadLine();
char[] notAllowedSymbols = { '!', '#', '#x27;, '%', '&', '(', ')', '*', ',', '+', '-' };
//your code goes here
for(int x=0;x<=password.Length;x++)
{
if(password.Contains(notAllowedSymbols[x]))
{
Console.WriteLine("Invalid");
break ;
}
else continue;
}
}
}
}