Create a text file called scorestxt with notepad with two


You have to create a list called scores that stores 4 numbers: the first two numbers are the number of win and lost games for the computer and the other two for the human opponent. Create a text file called scores.txt with notepad with two lines: the first two lines are the computer scores and the second line human scores.

Write a function called initScores to open the file and returns the list scores with the numbers in the text file.

>>initScores(scores)
[0,0,0,0]

Test it by adding numbers manually in the text file

 

Solution Preview :

Prepared by a verified Expert
Computer Engineering: Create a text file called scorestxt with notepad with two
Reference No:- TGS0663339

Now Priced at $20 (50% Discount)

Recommended (97%)

Rated (4.9/5)