title: Python Separating String into Words and Recursion
body: <p>I'm trying to create a code that will take in an input (example below)</p>
  
  <blockquote>
    <p>Input:<br>
    BHK158 VEHICLE 11<br>
    OIUGHH MOTORCYCLE 34.46<br>
    BHK158 VEHICLE 12.000<br>
    TRIR TRUCK 2.0<br>
    BLAS215 MOTORCYCLE 0.001<br>
    END  </p>
  </blockquote>
  
  <p>and produce an output where each license plate number is listed and the total cost is listed beside (example below)</p>
  
  <blockquote>
    <p>Corresponding output:<br>
    OIUGHH: 5.8582<br>
    BHK158: 5.75<br>
    TRIR: 2.666<br>
    BLAS215: 0.00017  </p>
  </blockquote>
  
  <p>The vehicle license plates are charged $0.25 per kilometer (the kilometers are the number values in the input list), trucks are charged $1.333 per kilometer, and motorcycles $0.17 per kilometer. The output is listed in descending order.</p>
  
  <p>Here is my code thus far: </p>
  
  <pre><code>fileinput = input('Input: \n')
  split_by_space = fileinput.split(' ')
  
  vehicles = {}
  
  
      if split_by_space[1] == 'VEHICLE':
          split_by_space[2] = (float(split_by_space[2]) * 0.25) 
      elif split_by_space[1] == 'TRUCK':
          split_by_space[2] = float(split_by_space[2]) * 1.333 
      elif split_by_space[1] == 'MOTORCYCLE':
          split_by_space[2] = float(split_by_space[2]) * 0.17 
  
      if split_by_space[0] in vehicles:
          previousAmount = vehicles[split_by_space[0]]
          vehicles[split_by_space[0]] = previousAmount + split_by_space[2]
      else:
          vehicles[split_by_space[0]] = split_by_space[2]
  </code></pre>
  
  <p>Thanks, any help/hints would be greatly appreciated.</p>