Feb-21-2019, 11:34 PM
Hey, i need help with a class task I got today.
A program is required to read the data for each member from the text file. The program should use this data to find then display the furthest distance walked. The names of every member who has walked more than 70% of the furthest distance should be written to an empty text file so that the file can be printed out later.
The text file is :
Nikolai,Bryant,145.6
Susan,Brown,34.2
Teressa,Jones,398.5
Martin,Daly,256.9
Ross,Durrant,409.0
Greg,Watson,99.2
Wendy,Russell,87.4
Pamela,Adkins,73.6
Ian,Hunter,385.7
James,Kerr,505.2
Lesley,Wallace,68.4
Kim,Pettigrew,256.4
Steven,Johnstone,23.4
Ali,Hussain,12.1
Hasan,Abbas,302.0
Jacek,Nowak,199.9
Mirka,Kowalski,176.8
Rudo,Hyper,120.2
Tisa,Sullivan,484.2
Albert,Nvodo,385.8
So far i tried saving the Name,Surname and Distance as seperate lists(arrays) and later on i tried using the max() function to find the furthest distance walked, but the anwser i always get is 99.2 when it actually is 505.2, I think it is because they are stored as strings insted of floats and it somehow messes it up. Sorry for sounding so unprofessional but i just started learning python 2 weeks ago.
A program is required to read the data for each member from the text file. The program should use this data to find then display the furthest distance walked. The names of every member who has walked more than 70% of the furthest distance should be written to an empty text file so that the file can be printed out later.
The text file is :
Nikolai,Bryant,145.6
Susan,Brown,34.2
Teressa,Jones,398.5
Martin,Daly,256.9
Ross,Durrant,409.0
Greg,Watson,99.2
Wendy,Russell,87.4
Pamela,Adkins,73.6
Ian,Hunter,385.7
James,Kerr,505.2
Lesley,Wallace,68.4
Kim,Pettigrew,256.4
Steven,Johnstone,23.4
Ali,Hussain,12.1
Hasan,Abbas,302.0
Jacek,Nowak,199.9
Mirka,Kowalski,176.8
Rudo,Hyper,120.2
Tisa,Sullivan,484.2
Albert,Nvodo,385.8
So far i tried saving the Name,Surname and Distance as seperate lists(arrays) and later on i tried using the max() function to find the furthest distance walked, but the anwser i always get is 99.2 when it actually is 505.2, I think it is because they are stored as strings insted of floats and it somehow messes it up. Sorry for sounding so unprofessional but i just started learning python 2 weeks ago.