Followers on the first and last days
Fill in the blanks · Basic · §9.3 Reading a file
followers.txt holds the follower count measured each day, one per line. Fill in the two blanks so that the code prints how many followers were gained from the first day to the last day. Grading also runs the code with different file contents.
Code with blanks
f = open("followers.txt", "r")
lines = f.readlines()
f.close()
first = ____
last = ____
print("Followers gained:", last - first)File followers.txt
120
150
170Solve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.