title: Python - Generate String with Dynamic Values
body: <p>I am trying to create a multi-line string with a dynamic amount of lines and values set inside it too.</p>
  
  <p>Code I have:</p>
  
  <pre><code>string = str(
  "hello \n"+
  "foo %f \n" % (-1) +
  for i in range(5):
      n = i + 1
      "bar %f \n" % (n) +
  "END"
  )
  print(str(string))
  </code></pre>
  
  <p>however this gives me a syntax error but the output I was looking for was something like this:</p>
  
  <pre><code>hello
  foo -1
  bar 0
  bar 2
  bar 3
  bar 4
  bar 5
  bar 6
  END
  </code></pre>