title: How to create integers with increasing digits in it more efficiently?
body: <p>The above code provides the list of integers whose digits are in ascending order. But with increasing numbers of digits, it becomes less efficient. Is there a way I any way I can make the code more efficient? Can we make it work for digits more than 30?</p>
  
  <pre><code>def gen_dig(digits):
      """Assumes digits is an integer;
      Returns a list containing integers with digits in ascending order"""
      lst=[]
      start=int('1'+'0'*digits)
      end=int('1'+'0'*(digits+1))
      for num in range(start,end):
          if str(num)==''.join(sorted(str(num))):
              lst.append(num)
      return lst
  </code></pre>