Give syntax of the setdefault() method.
Answer:
Syntax of setdefault method is:
dict.setdefault(key [,default=None])
where,
- key = the key to be searched
- default = the value to be returned if the key is not found.
Very Short Answer Type Questions (1 Mark each)
Very Short Answer Type Questions (1 Mark each)
Last updated at April 16, 2024 by Teachoo
Answer:
Syntax of setdefault method is:
dict.setdefault(key [,default=None])
where,