Dec-11-2018, 03:26 PM
Hi. I've been trying to finish my homework, but I don't know how to do the last part. I was given a data file called 'BP20dataset.csv' which contains three lists: patientID, age, and BP. The object of the exercise is: Write a code to identify the patients with high blood pressure (> 130 mmHg). The code should generate a list named highBPlist containing the patientID of the patients with BP > 130.
If, and enumerate statements have to be used. This is what I've come up with, but printing the highBPlist returns just []. Thanks in advance
If, and enumerate statements have to be used. This is what I've come up with, but printing the highBPlist returns just []. Thanks in advance
myFile = open('BP20dataset.csv') patientData = myFile.readlines() myFile.close() highBPlist = [] for BP, patientID in enumerate (highBPlist): if (i > 130): highBPlist.append(patientID) highBPlist = patientID.split(",")