Question
A Python program that processes a file calledbooks.txtwhose structure is described on slide 'Dataset for Q2 and Q3', to produce output with the following structure
A Python program that processes a file calledbooks.txtwhose structure is described on slide 'Dataset for Q2 and Q3', to produce output with the following structure (however, your program is allowed to print these lines in any order).
For each author whose name ends withs, give the text review count from books whose rating count is above than1000. If none of the book rating count is greater than 1000, show 0 as the number. You may assume thatsin the authors name will always be lowercase. If a single entry has multiple authors listed the program should only consider the last author of each entry when testing whether the name ends withs.
So on the file from previous page, the first few lines of output should be:
Douglas Adams 4989.0 Edward P. Jones 2626.0 Satyajit Das 82.0 Heidi Hayes Jacobs 0
File:
bookID,title,authors,average_rating,num_pages,ratings_count,text_reviews_count,publication_date,publisher
1,Harry Potter and the Half-Blood Prince (Harry Potter#6),J.K. Rowling,4.57,652,2095690,27591,2006-09-16,Scholastic Inc.
2,Harry Potter and the Order of the Phoenix (Harry Potter#5),J.K. Rowling,4.49,870,2153167,29221,2004-09-01,Scholastic Inc.
4,Harry Potter and the Chamber of Secrets (Harry Potter#2),J.K. Rowling,4.42,352,6333,244,2003-11-01,Scholastic
5,Harry Potter and the Prisoner of Azkaban (Harry Potter#3),J.K. Rowling,4.56,435,2339585,36325,2004-05-01,Scholastic Inc.
8,Harry Potter Boxed SetBooks 1-5 (Harry Potter#1-5),J.K. Rowling,4.78,2690,41428,164,2004-09-13,Scholastic
9,"Unauthorized Harry Potter Book Seven News: ""Half-Blood Prince"" Analysis and Speculation",W. Frederick Zimmerman,3.74,152,19,1,2005-04-26,Nimble Books
10,Harry Potter Collection (Harry Potter#1-6),J.K. Rowling,4.73,3342,28242,808,2005-09-12,Scholastic
12,The Ultimate Hitchhiker's Guide: Five Complete Novels and One Story (Hitchhiker's Guide to the Galaxy#1-5),Douglas Adams,4.38,815,3628,254,2002-04-30,Gramercy Books
13,The Ultimate Hitchhiker's Guide to the Galaxy (Hitchhiker's Guide to the Galaxy#1-5),Douglas Adams,4.38,815,249558,4080,2005-11-02,Del Rey Books
14,The Hitchhiker's Guide to the Galaxy (Hitchhiker's Guide to the Galaxy#1),Douglas Adams,4.22,215,4930,460,2004-08-03,Crown
16,The Hitchhiker's Guide to the Galaxy (Hitchhiker's Guide to the Galaxy#1),Douglas Adams/Stephen Fry,4.22,6,1266,253,2005-03-23,Random House Audio
18,The Ultimate Hitchhiker's Guide (Hitchhiker's Guide to the Galaxy#1-5),Douglas Adams,4.38,815,2877,195,1996-01-17,Wings Books
21,A Short History of Nearly Everything,Bill Bryson,4.21,544,248558,9396,2004-09-14,Broadway Books
22,Bill Bryson's African Diary,Bill Bryson,3.44,55,7270,499,2002-12-03,Broadway Books
23,Bryson's Dictionary of Troublesome Words: A Writer's Guide to Getting It Right,Bill Bryson,3.87,256,2088,131,2004-09-14,Broadway Books
24,In a Sunburned Country,Bill Bryson,4.07,335,72451,4245,2001-05-15,Broadway Books
25,I'm a Stranger Here Myself: Notes on Returning to America After Twenty Years Away,Bill Bryson,3.9,304,49240,2211,2000-06-28,Broadway Books
26,The Lost Continent: Travels in Small Town America,Bill Bryson,3.83,299,45712,2257,1990-08-28,William Morrow Paperbacks
27,Neither Here nor There: Travels in Europe,Bill Bryson,3.86,254,48701,2238,1993-03-28,William Morrow Paperbacks
28,Notes from a Small Island,Bill Bryson,3.91,324,80609,3301,1997-05-28,William Morrow Paperbacks
29,The Mother Tongue: English and How It Got That Way,Bill Bryson,3.93,270,28489,2085,1991-09-28,William Morrow Paperbacks
30,J.R.R. Tolkien 4-Book Boxed Set: The Hobbit and The Lord of the Rings,J.R.R. Tolkien,4.59,1728,101233,1550,2012-09-25,Ballantine Books
31,The Lord of the Rings (The Lord of the Rings#1-3),J.R.R. Tolkien,4.5,1184,1710,91,2004-10-21,Houghton Mifflin Harcourt
34,The Fellowship of the Ring (The Lord of the Rings#1),J.R.R. Tolkien,4.36,398,2128944,13670,2003-09-05,Houghton Mifflin Harcourt
37,The Lord of the Rings: Complete Visual Companion,Jude Fisher,4.5,224,359,6,2004-11-15,Houghton Mifflin Harcourt
50,Hatchet (Brian's Saga#1),Gary Paulsen,3.72,208,270244,12017,2000-04-01,Atheneum Books for Young Readers: Richard Jackson Books
53,Guts: The True Stories behind Hatchet and the Brian Books,Gary Paulsen,3.88,144,2067,334,2001-01-23,Delacorte Press
54,Molly Hatchet - 5 of the Best,Molly Hatchet,4.33,56,6,0,2003-06-10,Cherry Lane Music Company
55,Hatchet Jobs: Writings on Contemporary Fiction,Dale Peck,3.45,228,99,16,2005-11-01,The New Press
58,Changeling (Changeling#1),Delia Sherman,3.6,256,978,111,2006-08-17,Viking Juvenile
59,The Changeling Sea,Patricia A. McKillip,4.06,137,4454,302,2003-04-14,Firebird
61,The Changeling,Zilpha Keatley Snyder,4.17,228,1176,96,2004-06-08,iUniverse
63,The Changeling,Kate Horsley,3.55,339,301,43,2005-04-12,Shambhala
66,The Changeling (Daughters of England#15),Philippa Carr,3.98,369,345,12,1990-08-28,Ivy Books
67,The Known World,Edward P. Jones,3.83,388,29686,2626,2006-08-29,Amistad
69,The Known World,Edward P. Jones,3.83,576,22,3,2004-06-15,Harper
71,TradersGuns & Money: Knowns and Unknowns in the Dazzling World of Derivatives,Satyajit Das,3.83,334,1456,82,2006-05-15,FT Press
72,Artesia: Adventures in the Known World,Mark Smylie,4.13,352,52,4,2005-12-14,Archaia
75,Uncommon Carriers,John McPhee,3.95,248,1630,203,2006-05-16,Farrar Straus Giroux
76,Heirs of General Practice,John McPhee,4.17,128,268,22,1986-04-01,FarrarStraus and Giroux
77,The Control of Nature,John McPhee,4.24,288,3498,305,1990-09-01,FarrarStraus and Giroux
78,Annals of the Former World,John McPhee,4.34,720,3115,228,1999-01-06,FarrarStraus and Giroux
79,Coming Into the Country,John McPhee,4.22,448,5704,261,1991-04-01,FarrarStraus and Giroux
80,La Place de la Concorde Suisse,John McPhee,3.92,160,698,52,1994-04-01,FarrarStraus and Giroux
81,Giving Good Weight,John McPhee,4.23,288,542,36,1994-04-01,FarrarStraus and Giroux
83,Rising from the Plains,John McPhee,4.23,208,1341,98,1987-11-01,FarrarStraus and Giroux
85,The Heidi Chronicles,Wendy Wasserstein,3.75,81,1423,70,2002-03-01,Dramatists Play Service
86,The Heidi Chronicles: Uncommon Women and Others & Isn't It Romantic,Wendy Wasserstein,3.84,249,2766,64,1991-07-02,Vintage
89,Active Literacy Across the Curriculum: Strategies for ReadingWritingSpeakingand Listening,Heidi Hayes Jacobs,3.94,138,31,1,2006-03-29,Routledge
90,Simply Beautiful Beaded Jewelry,Heidi Boyd,3.77,128,62,4,2006-03-14,North Light Books
92,Mapping the Big Picture: Integrating Curriculum & Assessment K-12,Heidi Hayes Jacobs,3.68,108,77,2,1997-01-28,Association for Supervision & Curriculum Development
94,Getting Results with Curriculum Mapping,Heidi Hayes Jacobs,3.25,192,55,5,2004-11-15,ASCD
100,Simply Beautiful Beading: 53 Quick and Easy Projects,Heidi Boyd,3.78,128,78,4,2004-08-19,North Light Books
103,God Emperor of Dune (Dune Chronicles#4),Frank Herbert,3.84,423,2785,166,1987-06-15,Ace Books
105,Chapterhouse: Dune (Dune Chronicles #6),Frank Herbert,3.91,436,38778,568,1987-07-01,Ace Books
106,Dune Messiah (Dune Chronicles #2),Frank Herbert,3.88,331,97494,2359,1987-07-15,Ace Books
107,Dreamer of Dune: The Biography of Frank Herbert,Brian Herbert,4.01,592,784,21,2004-07-01,Tor Books
109,Heretics of Dune (Dune Chronicles#5),Frank Herbert,3.86,480,272,20,1984-04-16,Putnam
117,Heretics of Dune (Dune Chronicles #5),Frank Herbert,3.86,471,45388,644,1987-08-15,Ace Books
119,The Lord of the Rings: The Art of the Fellowship of the Ring,Gary Russell,4.59,192,26153,102,2002-06-12,Houghton Mifflin Harcourt
122,The Power of One (The Power of One#1),Bryce Courtenay,4.35,544,69167,4551,1996-09-29,Ballantine Books
123,The Power of One (The Power of One#1),Bryce Courtenay,4.35,291,45,13,2005-09-13,Delacorte Books for Young Readers
130,Power of an Hour: Business and Life Mastery in One Hour a Week,Dave Lakhani,3.34,205,174,16,2006-05-19,Wiley
131,The Power of One: The Solo Play for PlaywrightsActorsand Directors,Louis E. Catron,3.67,240,10,0,2000-02-07,Heinemann Drama
132,How to BuySell & Profit on eBay: Kick-Start Your Home-Based Business in Just Thirty Days,Adam Ginsberg,3.48,336,76,9,2005-05-04,William Morrow Paperbacks
133,eBay for Dummies,Marsha Collier,3.5,386,111,9,2006-10-30,Wiley
137,Starting an eBay Business for Dummies,Marsha Collier,3.55,384,55,4,2004-09-17,Wiley
138,eBay: Top 100 Simplified Tips & Tricks,Julia Wilkinson,4.27,260,9,0,2006-06-06,Wiley
139,ebay Timesaving Techniques for Dummies,Marsha Collier,3.39,391,22,1,2004-05-31,Wiley
140,eBay Business All-in-One Desk Reference for Dummies,Marsha Collier,3.89,864,17,3,2005-04-25,Wiley
142,Ruby Ann's Down Home Trailer Park Cookbook,Ruby Ann Boxcar,4.12,240,50,5,2005-05-03,Citadel
144,Ruby Ann's Down Home Trailer Park BBQin' Cookbook,Ruby Ann Boxcar,4.08,206,13,2,2005-05-03,Citadel
147,Rails Cookbook: Recipes for Rapid Web Development with Ruby,Rob Orsini,3.48,514,64,1,2007-01-01,O'Reilly Media
159,Dinner with Anna Karenina,Gloria Goldreich,2.99,360,411,65,2006-01-28,Mira Books
160,Tolstoy: Anna Karenina,Anthony Thorlby,4.19,128,1204,33,1987-11-26,Cambridge University Press
163,The Untouchable,John Banville,3.95,367,2163,216,1998-06-30,Vintage
165,Untouchables: My Family's Triumphant Journey Out of the Caste System in Modern India,Narendra Jadhav,3.82,320,308,40,2005-09-27,Scribner
171,The Evidence-Based Social Work Skills Book,Barry R. Cournoyer,3.4,216,10,0,2003-09-22,Pearson
181,A Wrinkle in Time: With Related Readings (A Wrinkle in Time Quintet #1),Madeleine L'Engle,4,250,36,6,2002-05-01,EMC/Paradigm Publishing
182,Literature Circle Guide: A Wrinkle in Time,Tara MacCarthy,3.6,32,15,0,2002-01-01,Teaching Resources
201,Una arruga en el tiempo " A Wrinkle in Time,Madeleine L'Engle,4,205,6,1,1984-06-01,Turtleback Books
204,The Long Shadow (The Morland Dynasty#6),Cynthia Harrod-Eagles,4.12,367,376,17,1994-06-01,LittleBrown Book Group
205,A Long Shadow (Inspector Ian Rutledge#8),Charles Todd,4.11,352,3086,237,2006-01-03,William Morrow
208,A Shadow in Summer (Long Price Quartet#1),Daniel Abraham,3.6,331,9852,633,2006-03-07,Tor Books
230,The Burnt Orange Heresy (Vintage Crime/Black Lizard),Charles Willeford,3.89,144,98,11,1990-10-03,Vintage
231,I am Charlotte Simmons,Tom Wolfe,3.42,738,20888,1688,2005-08-30,Picador USA
244,The Puffin Book of Nonsense Verse,Quentin Blake,4.02,287,81,6,1996-10-03,Puffin
247,Quiet Days in Clichy,Henry Miller,3.69,154,3381,141,1994-01-13,Grove Press
250,Tropic of Capricorn,Henry Miller,3.78,348,14872,459,1994-01-13,Grove Press
251,Nexus (The Rosy Crucifixion#3),Henry Miller,4.1,316,3261,58,1994-01-13,Grove Press
252,Sexus (The Rosy Crucifixion#1),Henry Miller,3.98,506,7805,251,1994-01-12,Grove Press
253,The Air-Conditioned Nightmare,Henry Miller,3.83,292,2699,142,1970-01-17,New Directions
277,Writing,Marguerite Duras,3.75,91,778,44,1999-05-06,Brookline Books
295,Treasure Island,Robert Louis Stevenson,3.83,311,318753,6734,2001-09-15,Kingfisher
297,Treasure Island,Robert Louis Stevenson,3.83,245,5967,276,2005-06-01,Simon & Schuster
313,100 Years of Lynchings,Ralph Ginzburg,4.61,270,88,4,1996-11-22,Black Classic Press
330,On Beyond Zebra!,Dr. Seuss,4.04,64,2815,164,1955-09-12,Random House Books for Young Readers
332,The Wedding Clause,Debbie Raleigh,3.6,256,95,13,2005-06-07,Zebra
333,The Zebra Wall,Kevin Henkes,3.44,147,217,24,2005-02-15,Greenwillow Books
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started