FAQ: Code Challenge: Queries - Code Challenge 7

This community-built FAQ covers the “Code Challenge 7” exercise from the lesson “Code Challenge: Queries”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development
Data Science

FAQs on the exercise Code Challenge 7

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

How do we order results by title but ignore the preposition (i.e. a, the)? So article “A Recall Bares GM’s Love of Red Tape” would ignore the “a” and show in alphabetical with the word “recall?”

1 Like

First we would need a list of known articles we do not wish to see at the beginning of titles in the alphabetized list. We would then find any title that begins with one, append the title with a comma and a space, remove the word from the title and append it. Finally trim the white space left at the beginning.

  • create list of articles
  • iterate over titles, checking the first word against that list
    • remove the word
    • append a comma and space
    • append the word
    • trim white space

We’ll likely want to split each title into a list, whereby white space is not an issue and we can exactly match the word, not just the characters.

See if you can come up with a list of titles for us to jointly experiment on and then compare our attempts.

1 Like