Python_Institute
PCAP-31-03 · Question #30
Which of the following lines of code will work flawlessly when put independently inside the add_new () method in order to make the snippet's output equal to [0, 1, 2]? (Select two answers)
The correct answer is A. self.queue.append(self.get_last() + 1) C. self.queue.append(self.queue[-1] + 1). See the full explanation below for the reasoning.
Question
Which of the following lines of code will work flawlessly when put independently inside the add_new () method in order to make the snippet's output equal to [0, 1, 2]? (Select two answers)
Exhibit
Options
- Aself.queue.append(self.get_last() + 1)
- Bself.queue.append(get_last() + 1)
- Cself.queue.append(self.queue[-1] + 1)
- Dqueue.append(self.get_last() + 1)
How the community answered
(24 responses)- A83% (20)
- B13% (3)
- D4% (1)
Community Discussion
No community discussion yet for this question.
