← 2023 questions

2023 / INSTAGRAM / QUESTION 2

Personalised feed

Try the question in your own editor, then check your output below.

THE QUESTION

The Instagram algorithm notes the type of content Finnick likes or skips past.

Finnick likes cooking reels, clothing posts, rugby posts and anything meme related. Finnick skips past political posts, diving compilations, celebrity drama and pet posts.

Use while loops to program an algorithm that decides what type of content will show up in Finnick’s feed again based on his likes and dislikes. The program should print out all eight examples of content with either “keep in feed” or “hide from feed” e.g.

rugby posts: keep in feed

political posts: hide from feed

And at the end it should also print out the amount of posts that stay or do not stay in Finnicks feed e.g.

Posts that will stay in Finnick's feed: 4

Posts that will not stay in Finnick's feed: 4

Question by Araa. Source: Girls In Code SEA — Behind the Screens, 2023, slide 16.

CHECK YOUR ANSWER

Try your answer.

Run your program in your own editor, then paste its output below. This checks the stated output; it does not assess your full program. Practice attempts do not affect competition scores.

Enter one “content: keep in feed” or “content: hide from feed” line for each of the eight content types, using the names in the question. Any line order is accepted.

Enter the number kept, then the number hidden.

Reveal worked answer

Feed decisions

cooking reels: keep in feed
clothing posts: keep in feed
rugby posts: keep in feed
anything meme related: keep in feed
political posts: hide from feed
diving compilations: hide from feed
celebrity drama: hide from feed
pet posts: hide from feed

Counts

[4, 4]

Each of the four liked categories stays; each of the four disliked categories is hidden.