SHARE
TWEET

cs170

a guest Apr 20th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def ExtractDataFromFile():
  2.  
  3.     YearsList = []
  4.     ManufacturersList = []
  5.     ModelsList = []
  6.     DescriptionsList = []
  7.     TransmissionsList = []
  8.     TransmissionsTypesList = []
  9.     EnginesCapacityList = []
  10.     FuelTypesList = []
  11.  
  12.     CarTypesFile = open("carsData.txt",'r')
  13.     CarData = CarTypesFile.readlines()
  14.     CarTypesFile.close()
  15.  
  16.     for lines in CarData:
  17.         YearsList.append(lines.split('*')[0])
  18.         ManufacturersList.append(lines.split('*')[1])
  19.         ModelsList.append(lines.split('*')[2])
  20.         DescriptionsList.append(lines.split('*')[3])
  21.         TransmissionsList.append(lines.split('*')[4])
  22.         TransmissionsTypesList.append(lines.split('*')[5])
  23.         EnginesCapacityList.append(lines.split('*')[6])
  24.         FuelTypesList.append(lines.split('*')[7])
  25.  
  26.     return YearsList,ManufacturersList,ModelsList,DescriptionsList,TransmissionsList,TransmissionsTypesList,EnginesCapacityList,FuelTypesList,
  27.  
  28. def NumberOfAutomaticTransmissions(TransmissionsTypesList):
  29.  
  30.     TransAuto = []
  31.  
  32.     for type in TransmissionsTypesList:
  33.         if type == 'Automatic':
  34.             TransAuto.append()
  35.  
  36.     totalautomatics = len(TransAuto)
  37.  
  38.     return totalautomatics
  39.  
  40.  
  41. def main(TransmissionsTypesList):
  42.  
  43.     ExtractDataFromFile()
  44.     automatics = NumberOfAutomaticTransmissions(TransmissionsTypesList)
  45.  
  46.  
  47. main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top