New: Practice Python, JavaScript & SQL with AI feedback — Try ActiveSkill free →

Day 6, Bug Fixing Exercise 2

Explanation

Line 1 was

file = open("data.txt", 'r'')

but it should be

file = open("data.txt", 'w')

Changing 'r' to 'w' makes it possible to add text to the text file.

 

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.