CJCoding With Joseph
15free / daySign inCreate account

Lines And Their Lengths

Three lines read from input are written to lengths.txt and the file is then read back with a loop that is already in place. Inside it, remove the newline from the line with rstrip and print the line, a colon, a space and the line's length, one per line in file order. Input: three lines, no prompt.

Expected Output:

cat: 3
house: 5
hi: 2

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
Files
📥 Auto-Input:
cat\nhouse\nhi\n
This input is automatically fed to your program's stdin
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.