Question
python 3
Define a function that uses two lists similar to the following to create a dictionary: items = [laptop, tablet, smartpho
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program :

items = ['laptop','tablet','smartphone','reader','camera']
price = [749,199,399,99,1149]

res = dict(zip(items, reversed(price)))

item = input("Which item's price do you want to know? ")
x = res.get(item)
if x is not None:
    print("The price of the {} is ${}".format(item,x))
else:
    print("Sorry! {} is not in our catalog.".format(item))

Screenshot of the program :

Output 1 :

Output 2 :

Please give a up vote .....
Thank you.......

Add a comment
Know the answer?
Add Answer to:
python 3 Define a function that uses two lists similar to the following to create a...
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
  • Expected submission: 1 Python file, Graph_Data.py Make a file called Graph_data Inside this file create 3...

    Expected submission: 1 Python file, Graph_Data.py Make a file called Graph_data Inside this file create 3 functions: 1.) BarGraph: This function should take 5 parameters, X-axis data, y-axis data, X-axis label, y-axis label, title. It will create a bar graph using the above data and display it. 2.) Line Graph: This function is the same as above, except with a line graph instead of a bar graph 3.) SaveGraph: This function is the same as BarGraph, except it saves the...

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