Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, please check the below pics of Python code in visual studio code and when I run it in terminal bash I got the output

Hello, please check the below pics of Python code in visual studio code

and when I run it in terminal bash I got the output like in the second pic below

I like to have it like the third pic below.

I created the text file callede test.txt like in the forth pic below.

do I need to put more text in the text file before I run the code?

or do need to create another text file there I open the text file and enter som input in?

Thanks!

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

[MacBook-Air-som-tillhor-Stefan:PythonHardWayEx stefanaxelssons python 3 ex 20. py test.txt First let's print the whole file: 010516c040> Now let's rewind, kind of like a tape. Let's print three lines: 1 This is line 1 2 This is line 2 3 This is line 3 MacBook-Air-som-tillhor-Stefan:PythonHardWayEx stefanaxelsson\$ $ python 3.6 ex 20. py test.txt First let's print the whole file: This is line 1 This is line 2 This is line 3 Now let's rewind, kind of like a tape. Let's print three lines: 1 This is line 1 2 This is line 2 3 This is line 3 This is line 1 This is line 2 This is line 3

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

Recommended Textbook for

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions