Question: In Python: There are two issues to keep in mind when reading text files: 1 . Each line ends in a newline character. Use the
In Python:
There are two issues to keep in mind when reading text files:
Each line ends in a newline character. Use the strip method to remove itRefer to lecture on Text Files.
The data is stored as a string. Just as we have with user input, we need to convert to int or float if we want to process numeric data.
Step : Use Notepad, TextEdit, or a program see previous exercises to create a text file called gameScores.txt Enter several arbitrary scores, each on a separate line. For example:
gameScores.txt TextEdit
Step : Write a program to read gameScores.txt one line at a time, to calculate the total score. Display the total when finished. For example:
Total:
No comments required. You may copypaste your code into the textbox below, or attach your program file using the Documents button.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
