Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beginner Issue #2 Solution #74

Merged
merged 1 commit into from
Oct 8, 2018
Merged

Beginner Issue #2 Solution #74

merged 1 commit into from
Oct 8, 2018

Conversation

david-bour
Copy link

@david-bour david-bour commented Oct 7, 2018

Problem #2

Complete the look_up_profile() function that takes name and a field as arguments included below
The function should check if name is an actual contact's firstName and the given field exists in that contact dictionary.
If both are true, then return the "value" of that field.
If name does not correspond to any contacts then return "No such contact"
If the field does not correspond to any valid properties of a contact found to match name then return "No such property"

Solution

Iterate the dictionary and lookup if the attributes are present. Runs at O(N) time.

@david-bour david-bour changed the title Solves solution profile lookup Beginner Issue #2 Oct 7, 2018
@david-bour david-bour changed the title Beginner Issue #2 Beginner Issue #2 Solution Oct 7, 2018
@the-vampiire the-vampiire merged commit e99a230 into the-vampiire:master Oct 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants