Beginner Event 1: The 100-meter dash
In the 100-meter dash, you will be given the finish times of our runners. You will be asked to sort the times and indicate the gold, silver, and bronze winners.
Working with data is the bread and butter of the IT pro. Many applications produce unformatted data—or seemingly unformatted data. What is wrong with using the old-fashioned comma-separated value (CSV) file? They are nice to have, easy to work with, and import directly into Office Excel, Word, and Access.
Like we said, CSV files are nice to have, but for this scenario, you do not have one. You have a text file with the times from the running of the 100-meter dash, and you need to write a script that will determine who wins the gold, silver, and bronze medals (the first three places, for you non-sports fans out there.) The results from the 100-meter dash are found in the Competitor's Pack in a file called 100 Meter Event.txt.
To successfully complete this scenario you will need to do the following:
· Figure out how to read the text file.
· Figure out how to read the name, country, and time from each row.
· Figure out how to sort the contents of the file by the time.
· Select the top three finishers (in a race, the smallest number is the fastest, so choose the three smallest numbers).
· Display the name, country, and time of the top three runners.
Note: You may wish to create a new file to hold the sorted data, and then read the top three lines of the file. You may want to convert the 100 Meter Event.txt file into a CSV file before you attempt to sort it. You do not need to include code or scripts that do this if you do not want to do so.
Advanced Event 1: The 100-meter dash The 100-meter dash event is the shortest outdoor distance. In this event, you will be required to read a text file and to determine the shortest lines of text that it contains.
Advanced Event 1: The 100-meter dash
The 100-meter dash event is the shortest outdoor distance. In this event, you will be required to read a text file and to determine the shortest lines of text that it contains.
In this event, you will be required to read the Personal Information Cards_ADV1.txt file in the Competitor’s Pack and determine the shortest lines of text that the file contains. You will need to display to the console the first three shortest lines.