Answer to Question #274257 in Python for Happpy

Question #274257

Assume, you have been given a tuple with details about books that won the Good Reads Choice Awards.

book_info = (

("Best Mystery & Thriller","The Silent Patient",68821),

("Best Horror","The Institute",75717),

("Best History & Biography","The five",31783 ),

("Best Fiction","The Testaments",98291)

)

Write a Python program that prints the award category, the book name, and its total votes earned as shown below.


Output:

The Silent Patient won the 'Best Mystery & Thriller' category with 68821 votes

The Institute won the 'Best Horror' category with 75717 votes

The five won the 'Best History & Biography' category with 31783 votes

The Testaments won the 'Best Fiction' category with 98291 votes

===================================================================


1
Expert's answer
2021-12-02T00:35:58-0500
book_info = (


("Best Mystery & Thriller",
"The Silent Patient won the Best Mystery & Thriller category with 68821 votes",68821),


("Best Horror","The Institute won the 'Best Horror' category with 75717 votes",75717),


("Best History & Biography","The five The five won the 'Best History & Biography' category with 31783 votes",31783 ),


("Best Fiction","The Testaments won the 'Best Fiction' category with 98291 votes",98291)


)


print ("The original list is : " + str(book_info))
res = [lis[1] for lis in book_info]
print (str(res),"\n")

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS