Write the code for a python function called loaddictionary


Problem

Write the code for a Python function called loadDictionary that accepts a dictionary, a list, and a letter (with a default value of 'X') and stores the list in the dictionary using the letter as the key before returning the entire dictionary.

The function prototype MUST be:

def loadDictionary(book, sequence, key = 'X') :

For example, given the following variables:
letter = 'Q'
myDict = { }
seq1 = [31, 32, 33, 34, 35, 36, 37, 38, 39]
then the function call and print:
newDict = loadDictionary(myDict, seq1, letter)
print(newDict)
would display:
{'Q': [31, 32, 33, 34, 35, 36, 37, 38, 39]}

Request for Solution File

Ask an Expert for Answer!!
Python Programming: Write the code for a python function called loaddictionary
Reference No:- TGS03323508

Expected delivery within 24 Hours