Ho! I am in need of thine assistance fellow followers of the programming discipline. I have here a devil-ish piece of parchment, of which a destitute acquaintance of mine proposed for me to solve, but alas, I was not able to correctly do so, much to my heart's dismay:
#!/usr/bin/python3
def bestow(tidings, scroll=[]):
scroll.append("I bestow to you: " + tidings)
return scroll
I = bestow("Alexis Texas")
II = bestow("Mia Khalifa", [])
III = bestow("Asa Akira")
print ("{0}, {1}, {2}".format(I, II, III))
I desire an understanding of why thy code spits out the following result:
['I bestow to you: Alexis Texas', 'I bestow to you: Asa Akira'], ['I bestow to you: Mia Khalifa'], ['I bestow to you: Alexis Texas', 'I bestow to you: Asa Akira']
I happened to have previously thought that def bestow
would be granted its default scroll
parameter each time it is called, and as such, a new scroll
would be instantiated for every call to thine function, as such this is what I thought would be the result of the print commandment:
['I bestow to you: Alexis Texas'], ['I bestow to you: Mia Khalifa'], ['I bestow to you: Asa Akira']
but that is evidently far from the truth.
Can someone please help me see with eyes unclouded by ignorance? I thanketh thee ahead of its due.