title: Right-to-Left and Left-to-Right printed nicely
body: <p>I want it to produce the number next to a word so that I can ask the user to select the word by using the corresponding number.</p>
  
  <p>This is my code</p>
  
  <pre><code>alt_words = hlst
  loopnum = 8
  for i in range(loopnum):
          if i &lt; len(alt_words):
              print('{0}. {1:&lt;20}'.format((i+1), alt_words[i]), end =' ')
              if i == 0:
                  print('', end=' ')
          if i + 9 &lt;= len(alt_words):
              print('{0}. {1:&lt;20}'.format((i+9), alt_words[i+8]), end =' ')
          if i + 17 &lt;= len(alt_words):
              print('{0}.  {1:&lt;20}'.format((i+17), alt_words[i+16]), end=' ')
          print('\n'+'-'*80)
  </code></pre>
  
  <p>It produces this
  <a href="https://i.stack.imgur.com/9uVQH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9uVQH.png" alt="Output from code"></a></p>
  
  <p>The first number of each line gets printed on the left, but the word on the right, while the rest of the numbers and words get printed RTL. It seems that once python has started printing on a line LTR it can switch to RTL, but not back from RTL to LTR. Note how even the periods are printed to the right of the number for the second set of numbers on each line.</p>
  
  <p>It works perfectly well and looks nice with english words:</p>
  
  <p><a href="https://i.stack.imgur.com/nc6t8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nc6t8.png" alt="python table works in english"></a></p>
  
  <p>I am guessing a work around might involve putting the number after the word, but I figure there must be a better way.</p>