title: Python_ how to change my lines of result?
body: <pre><code>def change_currency(sentence, rate):
      lines = sentence.splitlines()
  
      words = []
      for i in range(len(lines)):
          words.append(lines[i].split())
      true_wds = sum(words,[])
      for j in range(len(true_wds)):
          if j%4 ==3:
              true_wds[j] = 'YEN'
          elif j%4 ==2:
              true_wds[j] = str(float(true_wds[j])*rate)
          else:
              pass
      ans = ' '.join(true_wds)
      return ans
  
  menu = &quot;&quot;&quot;Pineapple : 1.5 USD
  Biscit : 1 USD
  Cupcake : 12 USD
  &quot;&quot;&quot;
  
  usd = 1000.0 # 1usd = 1000.0yen
  result = change_currency(menu, usd)
  print(result)
  </code></pre>
  <p>In this situation, my result of code is</p>
  <pre><code>Pineapple : 1500.0 YEN Biscit : 1000.0 YEN Cupcake : 12000.0 YEN
  </code></pre>
  <p>But, I want to change my result like this</p>
  <pre><code>Pineapple : 1500.0 YEN
  Biscit : 1000.0 YEN
  Cupcake : 12000.0 YEN
  </code></pre>
  <p>how can i solve this problem?</p>