runtime
152 / 500
question 152 Collections & Itertools · easy

The activity feed shows the oldest events

A repository page shows an activity feed: the newest limit events, newest first. activity_feed keeps the right number of events, but it lists them oldest first. Fix it.

Functionactivity_feed(events, limit=4)
eventsa list of event descriptions, oldest first
Returnsa list of at most limit events: the newest ones, newest first
Examples
callactivity_feed(['maya-k pushed 3 commits', 'devon-r starred fast-parser', 'lena-o opened issue 412', 'maya-k pushed 1 commit', 'ci-bot released v2.1.0', 'devon-r commented on 412'])returns['devon-r commented on 412', 'ci-bot released v2.1.0', 'maya-k pushed 1 commit', 'lena-o opened issue 412']
callactivity_feed(['maya-k pushed 3 commits', 'devon-r starred fast-parser', 'lena-o opened issue 412', 'maya-k pushed 1 commit', 'ci-bot released v2.1.0', 'devon-r commented on 412'], limit=2)returns['devon-r commented on 412', 'ci-bot released v2.1.0']
callactivity_feed(['first push'])returns['first push']

Loading your progress…

The activity feed shows the oldest events — Python practice · Runtime