View the step-by-step solution to:


Please help! I want to count the number of times bathroom appears in the comments.

This is what I have so


import json

with open('hotel_reviews.json') as json_data:

  hotel_data = json.load(json_data,) 


reviews = hotel_data['Reviews'] # list of reviews

print("There are",len(reviews),"reviews altogether.")

comment_lst = [] # will contain the review strings

for review in reviews:


len(comment_lst) # contains 233 comments--one for each reviewer.

counter = 0

for review in comment_lst:

  if comment_lst == 'bathroom':

    counter = counter + 1


print(f"The word 'bathroom' occurs {counter} times in the reviews for this hotel.")

I keep getting a value of 0.

Top Answer

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.


Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online