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

Profile Lookup #2

Open
the-vampiire opened this issue Oct 4, 2018 · 0 comments
Open

Profile Lookup #2

the-vampiire opened this issue Oct 4, 2018 · 0 comments
Labels
beginner beginner challenges free code camp challenges sourced from free code camp Hacktoberfest

Comments

@the-vampiire
Copy link
Owner

the-vampiire commented Oct 4, 2018

Credit: Adapted from Free Code Camp

Challenge

We have a list of dictionaries representing different people in our contacts list.

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"

starter code

contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["JavaScript", "Gaming", "Foxes"]
    }
];


def look_up_profile(name, field):
  pass # fill in your solution here


// Change these values to test your function
look_up_profile("Akira", "likes")
@the-vampiire the-vampiire added beginner beginner challenges free code camp challenges sourced from free code camp Hacktoberfest labels Oct 4, 2018
the-vampiire added a commit that referenced this issue Oct 5, 2018
@the-vampiire the-vampiire reopened this Oct 5, 2018
the-vampiire added a commit that referenced this issue Oct 8, 2018
the-vampiire added a commit that referenced this issue Oct 11, 2018
Initial Solution for Issue #2: Profile Lookup
the-vampiire pushed a commit that referenced this issue Oct 5, 2019
the-vampiire pushed a commit that referenced this issue Oct 21, 2019
* Profile Lookup #2 Solution

* Mutations

* Valid Parenthesis

* Delete valid-parenthesis_nikxtaco.py
the-vampiire pushed a commit that referenced this issue Oct 21, 2019
* Profile Lookup #2 Solution

* Valid Parenthesis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginner beginner challenges free code camp challenges sourced from free code camp Hacktoberfest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant