Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer this question as soon as possible thanks Question 6 (10 pts) Consider the following program: def what is_this ( f) : words =

Please answer this question as soon as possible thanks

image text in transcribed
Question 6 (10 pts) Consider the following program: def what is_this ( f) : words = {} for line in f: w = line . strip( ) .split( ) for item in w: if 'r' in item. lower( ) : words [item] = words . get (item, 0) + 1 return words f = open ( 'poem2 . txt' , 'r' ) d = what_is_this(f) f . close() print(d) The content of file poem2 . txt is: Roses are red, Violets are blue, Roses are red, Violets are blue, I cannot find a rhyme, What should I do? What is the display that results from running the above program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions