Question

In Python, having trouble writing this function. Define a function named makeDictionary with two parameters. The...

In Python, having trouble writing this function.

Define a function named makeDictionary with two parameters. The first argument passed the function must be a list of strings to be used as keys, while the second is a list of the same length containing values (of some type). This function must return a dictionary consisting of the keys paired with the corresponding values.

Help would be appreciated

0 0
Add a comment Improve this question Transcribed image text
Answer #1

def makeDictionary(a, b):
d = {}
for i in range(len(a)):
d[a[i]] = b[i]
return d
  
print(makeDictionary(['a', 'b', 'c'], [1, 2, 3]))

# Hit the thumbs up if you are fine with the answer. Happy Learning!

Add a comment
Know the answer?
Add Answer to:
In Python, having trouble writing this function. Define a function named makeDictionary with two parameters. The...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT