Question

Create a program that has 4 lists. One list has the title of 5 books. Another...

Create a program that has 4 lists.

One list has the title of 5 books. Another list has the price of the 5 books and another list has the quantity of the 5 books.

Put all 3 lists into a Master List(the fourth list).

Using a loop print out the Title of each book and the value of the inventory (quantity * price)

# The book "100 Years of Solitude" has an inventory value of $568.78

# Use Python

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

title_list = [
       '100 Years of Solitude Part 1',
       '100 Years of Solitude Part 2',
       '100 Years of Solitude Part 3',
       '100 Years of Solitude Part 4',
       '100 Years of Solitude Part 5'
   ]

price_list = [100, 105, 110, 115, 120]

quantity_list = [1, 2, 3, 4, 5]

final_list = []

for i in range(5):
   price = price_list[i] * quantity_list[i];
   s = 'The book "' + title_list[i] + '" has an inventory value of $' + str(price)
   final_list.append(s)


for x in final_list:
   print(x)

Add a comment
Know the answer?
Add Answer to:
Create a program that has 4 lists. One list has the title of 5 books. Another...
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
  • Write a C program to create a list of books details. The details of a book...

    Write a C program to create a list of books details. The details of a book include title, author, publisher, publishing year, no. of pages , price Perform the following with respect to the list of books created Display all the details of books written by a given author. Sort the details of books in the increasing order of price. Display the details of books published by a given publisher in a given year. Sort the list of books in...

  • please use C++ write a program to read a textfile containing a list of books. each...

    please use C++ write a program to read a textfile containing a list of books. each line in the file has tile, ... Question: Write a program to read a textfile containing a list of books. each line in the file has tile, ..... write a program to read a textfile containing a list of books. each line in the file has tile, ... Question: Write a program to read a textfile containing a list of books. Each line in...

  • Python help: Create two lists of 5 elements. The first list should be a series of...

    Python help: Create two lists of 5 elements. The first list should be a series of questions whose answer is either "T" or "F" (true or false). The second list should be the correct answers to those questions ("T" or "F"). Write a program that asks the user each question in the question list and compares their answer to the answer in the answer list. Print out whether or not they got the question correct and print out their final...

  • in python: Write a program that uses a two-dimensional list that has 4 rows, with 5...

    in python: Write a program that uses a two-dimensional list that has 4 rows, with 5 columns in each row. The program should do the following things 1. Create or fill in the list so that it has random numbers between 0 and 50. 2. Print the entire list using a loop.

  • Help needed related python ! Thanx :) #First let's ask the user for one of their...

    Help needed related python ! Thanx :) #First let's ask the user for one of their favorite book. # Now let's use concatenation to ask who wrote this book. # Create an empty dictionary to hold the favorite books and authors. # Use a for loop to prompt the user to enter 5 of their favorite books. # A general structure is given below. for book in favorite_book range(5): print (book) favorite_book = input("What is one of your favorite books?...

  • In Python! Create the program that print out only odd numbers 1,3,5,7,9 Use either a while...

    In Python! Create the program that print out only odd numbers 1,3,5,7,9 Use either a while loop or a for loop to print only odd numbers 1, 3, 5, 7, 9 *tip: you can use range () function, or a condition with ‘break’ (e.g, while count < 10) In python!: Create a program that print out 12 months of a year and associated numbers (e.g., January 1, February 2…). Two lists should be created, and then loop through the list...

  • I need this python program to access an excel file, books inventory file. The file called...

    I need this python program to access an excel file, books inventory file. The file called (bkstr_inv.xlsx), and I need to add another option [search books], option to allow a customer to search the books inventory, please. CODE ''' Shows the menu with options and gets the user selection. ''' def GetOptionFromUser(): print("******************BookStore**************************") print("1. Add Books") print("2. View Books") print("3. Add To Cart") print("4. View Receipt") print("5. Buy Books") print("6. Clear Cart") print("7. Exit") print("*****************************************************") option = int(input("Select your option:...

  • python Make another code block that creates a list using range( ) with 8 values starting...

    python Make another code block that creates a list using range( ) with 8 values starting with 1. print out your list Create a set from each of the three lists. Find the elements in common between the three sets.

  • PYTHON: Using Lists and Arrays! 3. Design a program that generates a seven-digit lottery number. The...

    PYTHON: Using Lists and Arrays! 3. Design a program that generates a seven-digit lottery number. The program should generate seven random numbers, each in the range of 0 through 9, and assign each number to a list element. (Random numbers were discussed in Chapter 5.) Then write another loop that displays the contents of the list.

  • Create a new Python program in IDLE, and save it as lab8.py.(Again, I recommend saving lab...

    Create a new Python program in IDLE, and save it as lab8.py.(Again, I recommend saving lab progranms Your Python program will do the following: Create an empty list . Use a for loop to ask the user for 10 numbers. Add each number to your list using the append metha . Use another for loop to print the list in reverse order, one per line . Use a while loop to count how many positive numbers are in the list...

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