Guest User

Untitled

a guest
Dec 18th, 2022
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.14 KB | None | 0 0
  1. def f(x=[]): # defaults to list if no X is provided
  2.     x.append(1)
  3.     return x
  4.  
  5. x = f()
  6. x = f()
  7. print(x) # prints [1,1] instead of [1]
Advertisement
Add Comment
Please, Sign In to add comment