Now that you have seen an example of how to read numbers from a file and find their average it’s time to practice some more. Pick one of the following options:
Hint: To do so, you’ll first have to find the average (as we did before). Then, you have to “reset” the file by closing it and re-opening it, then you can read the file again and compute the standard deviation using the following:
Modify the program we just wrote so that instead of reading numbers, it reads characters from the file my_second_file.txt. Print out the characters you read from the file one next to the other.
As before, for now we are telling you how many characters are in the file, namely 9. So that you know what to expect, here is what the contents of the file looks like: