Valid Foundations-of-Programming-Python Dumps shared by EduDump.com for Helping Passing Foundations-of-Programming-Python Exam! EduDump.com now offer the newest Foundations-of-Programming-Python exam dumps, the EduDump.com Foundations-of-Programming-Python exam questions have been updated and answers have been corrected get the newest EduDump.com Foundations-of-Programming-Python dumps with Test Engine here:
Complete the function get_dict_keys(data) that takes a dictionary and returns a list of all its keys. For example, get_dict_keys({ " name " : " John " , " age " : 25}) should return [ " name " , " age " ]. def get_dict_keys(data): # TODO: Return a list of all dictionary keys pass
Correct Answer:
See the Step by Step Solution below in Explanation. Explanation: Step 1: A dictionary stores data as key-value pairs. Step 2: The .keys() method returns the dictionary's keys. Step 3: To return the keys as a list, use list(data.keys()). Correct code: def get_dict_keys(data): return list(data.keys()) Example: print(get_dict_keys({ " name " : " John " , " age " : 25})) Output: [ ' name ' , ' age ' ]