1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
jasenka [17]
3 years ago
11

Which of the following code segments will display all of the lines in the file object named infile, assuming that it has success

fully been opened for reading?
a. while line in infile :
print(line)
b. while infile in line :
print(line)
c.for infile in line :
print(line)
d. for line in infile :
print(line)

Computers and Technology
1 answer:
zimovet [89]3 years ago
5 0

Answer:

d.

for line in infile :

   print(line)

Explanation:

for loop is used to iterate through the each line of the file using line variable. The file is accessed using the object infile. For example if the file name is "file.txt" and it is opened in read mode. It contains the following lines:

hi there friend

how are you

what are you doing

Then the above given chunk of code gives the following output

hi there friend

how are you

what are you doing

At each iteration each line of the the file is printed on the output screen. The print() method is used to display these lines in output.

You might be interested in
25 pts! If programmers cannot write an algorithm because the problem is too complex, which methodology can they use to reach an
Setler [38]

Answer:

D, most likely thats what I was taught .

3 0
4 years ago
Where could cloud computing fit in the organizational structure and operations?
vampirchik [111]

Answer:

Computing cloud could fit in the website under the IT directory, with total access to all employees and shareholders.

Explanation:

8 0
3 years ago
What is sent back after you sent FAFSA
MrRa [10]
FAFSA will send you back a SAR (Student Aid Report). They will send you an email giving you instructions on what to do what not to do. Which will be sent to you in a week. Then they will decide if the application is Approved or complete and rejected.
8 0
3 years ago
Deb is creating a form for scheduling appointments. Which control should Deb use for the user to set the date for the appointmen
castortr0y [4]

Answer:

Date Picker

Explanation:

She should use the date picker because she is setting the date for an appointment.

7 0
3 years ago
5. List three safety concerns when using hand<br> ertain safety<br> tools.
sveta [45]

Answer:

Inspect regularly. ...

Wear gloves. ...

Carry with care. ...

Don't pocket sharp objects. ...

Be aware of your surroundings. ...

Use the right tools.

6 0
3 years ago
Other questions:
  • An administrator working on a Windows Server 2016 Server Core installation needs to disable DHCP on all interfaces on the server
    12·1 answer
  • A Python function cannot under normal circumstances reference a module variable for its value.
    12·2 answers
  • According to the author, there are five hedging strategies organizations can pursue. One of them is: Select one: a. commit with
    5·1 answer
  • Is it safe to take apart a computer monitor?
    13·1 answer
  • Which of the following is used to describe the information used in
    12·1 answer
  • Kyla, a business analyst uses test scripts while testing an application before it is released to the client. Why do business ana
    5·1 answer
  • Anybody wanna be friends?
    10·2 answers
  • What is the best way of farming exotics in destiny?
    12·2 answers
  • Write C++
    6·1 answer
  • Supervisor: You will need to consolidate your trouble tickets
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!