title: Python Nested For Loops Augmentation Possible?
body: <p>Given a single string</p>
  <pre><code>abcd
  </code></pre>
  <p>I need to generate the following output:</p>
  <pre><code>['a', 'ab', 'abc', 'abcd', 'b', 'bc', 'bcd', 'c', 'cd', 'd']
  
  </code></pre>
  <p>I have put the following code together in Python 3.8 and it works, but is very clunky and inefficient:</p>
  <pre><code>text = 'abcd'
  final = [text[y:i+1] for i in range(len(text)) for y in range(len(text)) if len(text[y:i+1]) &gt; 0]
  print(sorted(final))
  </code></pre>
  <p>Is there a more elegant or efficient way to achieve the required output, without using nested for loops?</p>
  <p>Thanks</p>