words.txt holds three lines, red, green and blue, each with a new line at its end. A program reads part of it with read, then loops over the rest.
with open("words.txt") as f:
start = f.read(5)
for line in f:
print(line.strip().upper(), end=" ")
print(repr(start))
What does the program print?Log in to join the discussion.
Loading…