Home > other >  The default parameters of the basic problems consult!
The default parameters of the basic problems consult!

Time:03-24

Def demo (newitem, old_list=[]) :
Old_list. Append (newitem)
Return old_list
Print (demo (' d '))
Print (demo (' d ', [1, 2]))
Print (demo (' e '))
Output:
[' d ']
[1, 2, 'd']
[' d ', 'e']
Q1: the default parameters after the function definition is interpreted only once is what mean?
Q2: what output third behavior not [1, 2, 'd', 'e']?
  • Related