LearnPy Hub
← Classes & Objects problems
Medium

Playlist Player

Write class Player holding a list of songs and a current position, with next() and prev() that wrap around and current(). Read songs, then a line of commands (n or p); print the current song after each command.

Input

Songs, then commands.

Output

One line per command.

Sample 1

Input
a b c
n n n p
Output
b
c
a
c

Sample 2

Input
solo
n p
Output
solo
solo
solution.py
Output appears here
Playlist Player · Python practice problem · LearnPy Hub