We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 8: Dictionaries and Maps
Day 8: Dictionaries and Maps
Sort by
recency
|
2709 Discussions
|
Please Login in order to post a comment
C# Solution
Maybe another output option would be interesting to you.
...
string query;
while ((query = Console.ReadLine()) != null) // Read to the end. It is also suitable if the number of names being checked is unknown.
{
if (phoneList.TryGetValue(query, out string phone))
Console.WriteLine($"{query}={phone}");
else
Console.WriteLine("Not found");
}
Seems a good choice. Thanks
Be Aware: After the n lines of phone book entries, there are an unknown number of lines of queries.
One of solutions: while True: try: ... except EOFError: ...
This is my submission in JS
im failing in test case1 but passing all the other ones im about to loose it
the logic is correct but you wont pass the test cases since u print the outcome of the search right after the user inserts the name , not after the user inserts all the names hes searching for , correct me if im wrong
no all test cases will be passed.... once again re check the code you will understand..... because we don't know how many inputs exist those may be many...how can you insert all in first ..😅