""" - Python open() method to read csv file. - Return and print the total times the word "love" appeared in the list. - Specifically, in the index position "Song Title". - Other methods used split(); readline(); lower(); print() - The **for** Loop definition - A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string). - Additionally, an accumulator or counter was used, by using a variable = 0. When "love", was found it would keep a running total. - "charts.csv" was provided and was 500 lines (501 including the header) of the Billboard Hot 100 list from October 2021. """ file = open("charts.csv") # open the file file.readline() total = 0 love = "love" for line in file: linelist = line.split(",") loveIsDumb = linelist.lower() if love in loveIsDumb: total += 1 print(total,"\n\nLooking for love in all the wrong places!\n")
There are no results that match the criteria.