Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

a file named \games.txt\ exists and has 80 lines of data. you open the …

Question

a file named \games.txt\ exists and has 80 lines of data. you open the file with the following line afile = open(\games.txt\, \w\) you write two lines to the file in the program. how many lines are in the file when you close your

Explanation:

Step1: Understand file - opening mode

The "w" mode in the open function truncates the existing file, deleting all its contents.

Step2: Count lines after writing

After truncating the file, only the two lines that are written are present in the file.

Answer:

2