Question: Matthew works as a software developer in UC Inc. He is developing an application based on the Python language in which he has created a
Matthew works as a software developer in UC Inc. He is developing an application based on the Python language in which he has created a file named test.txt Now, he wants to open the file and display its content. He has written the following code:for line in opentesttxt:printline endThe file gets executed and displayed properly but is not closed properly. Which of the following code segments should Matthew use to avoid this issue?This type of question contains radio buttons and checkboxes for selection of options. Use Tab for navigation and Enter or space to select the option.optionAwith opentsettxt as f:for line in f:printline endoptionBfor line in opentexttxt:printline endoptionCfor line in opentesttxtprintline endoptionDwith opentesttxt as f:for line in f:printline end
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
