Day 8, Bug Fixing Exercise 1

Explanation

If the read() method is called two times, it returns an empty string the second time.To avoid that, we call the read() method once and store its output in a variable:

    content = file.read()

That helps us capture the output inside the variable and then we can use it throughout the rest of the code.

Recommended Course

Python Mega Course: Learn Python in 60 Days, Build 20 Apps
Learn Python on Udemy completely in 60 days or less by building 20 real-world applications from web development to data science.