← Back to Files
Question 405
Count The Lines
Count The Lines
The write step stores three fruit names, one per line, in fruit.txt. Open the file again in read mode, collect its lines with f.readlines() (one string per line, newline included) into lines and print how many there are: one number on its own line. There is no input.
Expected Output:
3= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Files
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.