easy5 pts · first answer countspythondebugging
Python default list surprise
What does this Python code print?
def add_tag(tag, tags=[]):
tags.append(tag)
return tags
add_tag("a")
print(add_tag("b"))Discussion 0
Join free to post in the discussion.
Related questions
- What a 504 from Nginx meansBackend Developer
- Built-in memoisation in PythonBackend Developer
- Safe counting in a Python dictBackend Developer
- Checking a key by its valueBackend Developer
- Missing key in a Python CounterBackend Developer
- Grouping with defaultdictBackend Developer
- What in checks on a Python dictBackend Developer
- Creating an empty set in PythonBackend Developer