0
Someone can explain me this code? 'Class Player'
class Track: def __init__(self, title, next): self.title = title self.next = next class Player: def __init__(self): self.head = None def add(self, title): if not self.head: self.head = Track(title, None) return curr = self.head while curr.next: curr = curr.next curr.next = Track(title, None)
2 Respostas
+ 2
Oh... technically it is a single linked list.
If the playlist is not empty, you must find the tail to add a title. There are lessons for it in SL.
+ 1
It looks like a music player. The first class makes two functions for title and next.
The player class looks like its made to add new songs but it hard to tell without additional context.