WSQ16. Cars

For this WSQ we had to create a program that read a text file and printed the average of some specific data contained in it.

In order to accomplish this WSQ, first, we had to open and read this text file from our program, which I explained in this post: https://manuelmadrigal.withknown.com/2015/mastery-30-reading-and-writing-of-files-in-python

The, by using a for loop we can go over the text file, line by line, collecting the data we care about by using a property of strings, with which we can get just the part of it that we desire.

Finally we get the average of the data by dividing the sum of all the values by the number of cars.

Here is the link to my program:https://github.com/Manuelmv94/TC1014/blob/master/wsq16.py

CC BY 4.0 WSQ16. Cars by Manuel Madrigal is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.