T Thịnh Võ Member Sep 20, 2021 #1 What will be the output of the following Python code? Code: a={1:5,2:3,3:4} print(a.pop(4,9)) A. 9 B. 3 C. Too many arguments for pop() method D. 4
What will be the output of the following Python code? Code: a={1:5,2:3,3:4} print(a.pop(4,9)) A. 9 B. 3 C. Too many arguments for pop() method D. 4
G Giao Linh New member Sep 20, 2021 #2 Answer: a Explanation: pop() method returns the value when the key is passed as an argument and otherwise returns the default value(second argument) if the key isn’t present in the dictionary. Upvote 0 Downvote
Answer: a Explanation: pop() method returns the value when the key is passed as an argument and otherwise returns the default value(second argument) if the key isn’t present in the dictionary.