Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

basic python why can i not print rest in the same way i can print first line? what do i need to do to make

basic python

why can i not print rest in the same way i can print first line?

what do i need to do to make it print rest?

image text in transcribed

In [1]: def open_function (b): f-open (b, 'r') for i in range (1): first-line-f.readline() #### ???? is this not right??? eturn first_line rest-f.readlines() return rest f.close bbb- Notepad File Edit Format View Help testbline 1 line 2 line 3 In [2]: open function ('bbb.txt') first_line-open_function ("bbb.txt') print(first_line) print (rest) this is the file test b line 1 Traceback (most rece NameError ipython-input-2-9da573f01c2b> i want to print rest in () 2 first_line- open_function ("bbb.txt') 3 print(first_line) 4 print(rest) also how can i ensure rest does not include the first line) NameError: name 'rest is not defined

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions

Question

Some financial institutions take the role of underwriter. Explain.

Answered: 1 week ago