title: Can I make a list comprehension that appends a value after a for loop
body: <pre><code>s = "lallalaiial" 
  subs = []
  
  for g in range(len(s)):
      for o in range(g, len(s)):
          substring = s[g:o+1]
          passable = True
          for v in range(len(substring)):
              if(substring[v] == "i"):
                  passable = False
          if(passable):
              subs.append(substring)
  
  print(subs)
  </code></pre>
  
  <p>Can I make a list comprehension for the for loops? A new value should be added to the list only after the last for loop has checked the list. I do not want to remove the last for loop - even if the same result could be achieved without it.</p>