 using it to avoid problems like memory leaks.</li>
      </ul>

      <h3>Example 2: What Happens if the File Doesn’t Exist?</h3>
      <p>
        Let’s try to open a file that does not exist:
      </p>
      <div class="code-block">
        <pre>
# Trying to open a non-existent file
file = open("nonexistent.txt", "r")  # This file does not exist
content = file.read()
print(content)
file.close()
  </pre>
      </div>
      <p>
        This will give an error:
      </p>
      <pre>
FileNotFoundError: