0
def m(list=[]):
    list.append(5)
    return list
    
print(m())   #[5]
print(m())   #[5,5]

I am getting unexpected output from the above Code as: [5] [5,5]

While I am expecting the following output: [5] [5]

Could anyone please explain what is the reason of this kind of behaviour.

ABHINAV MEHTA
  • 25
  • 1
  • 5

0 Answers0