logo CodeStepByStep logo

readme

Language/Type: Python file input

Consider a file called readme.txt that has the following contents:

6.7        This file has
        several input lines.

10 20    30    40

test

What would be the output from the following code when it is run on the readme.txt file?

with open("readme.txt") as file:
    count = 0
    for s in file:
        print("input:", s)
        count += 1
    print(count, "total")
output

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.