0
Someone can explain me this code? i solved but i dont understand his fuction
class Browser: def __init__(self): self.links = [] def is_empty(self): return self.links == [] def push(self, link): self.links.insert(0, link) def pop(self): return self.links.pop(0) x = Browser() x.push('about:blank') x.push('www.sololearn.com') x.push('www.sololearn.com/courses/') x.push('www.sololearn.com/courses/JUMP_LINK__&&__python__&&__JUMP_LINK/') while not x.is_empty(): print(x.pop())
3 Respostas
+ 1
An instance of the Browser is created (x), links are added. In the while loop, links are removed until it is empty.
0
Lisa I thought that if there was an empty link, the loop would delete it and not that it was all deleted until it was empty
0
What is an empty link?
Try to run this code and see what is being removed.