### Unfinished Loop - Bug Fixing #1

Oh no, Timmy's created an infinite loop! Help Timmy find and fix the bug in his unfinished for loop!

Difficulty: introductory

Starter code:

def create_array(n):
	

Solutions:
def create_array(n):
    res=[]
    i=1
    while i<=n:
        res+=[i]
        i+= 1
    return res

def create_array(n):
    return [i for i in range(1,n+1)]

create_array = lambda n: list(range(1,n+1))


def create_array(n):
    res = []
    i = 1
    while i <= n:
        res.append(i)
        i += 1
    return res

def create_array(n):
    res=[]
    for a in range(0,n):
        res.append(a+1)
    return res

def create_array(n):
    return [i + 1 for i in range(n)]

def create_array(n):
    return list(range(1,n + 1))

def create_array(n):
    res=[]
    i=1
    while i<=n: 
      res +=[i]
      i = i+1
    return res

def create_array(n):
    lst1 = list(range(n+1))
    return lst1[1:]

from typing import List

def create_array(n: int) -> List[int]:
    """ Fix the unfinished loop. """
    result = []
    ix = 1
    while ix <= n:
        result.append(ix)
        ix += 1
    return result

def create_array(n):
    res=[]
    i=1
    while i <= n:
        res.append(i)
        i += 1
    return res

print(create_array(5))

def create_array(n):
    res=[]
    i=1
    while i<=n: 
        res+=[i]
        i = i + 1
        
    return res

print(create_array(4))

def create_array(n):
    res=[]
    i=1
    while i<=n: 
        res+=[i]
        return res
        
        
def create_array(n):
    res = []
    i = 1
    while i <= n:
        res.append(i)
        i += 1
    return res

def create_array(n):
    res= list()
    for i in range(1,n+1,1):
        res.append(i)
        
    return res

def create_array(n):
    '''array add nuber to list'''
    res = []
    i = 1
    while i <= n:
        res.append(i)
        i+=1
    return res
    


def create_array(n):
    res=[]
    i=1
    while 1<=n: 
        res+=[i]
        i = i + 1
        n = n - 1
    return res

def create_array(some_number):
    result = []
    counter = 1
    while counter <= some_number: 
        result.append(counter)
        counter += 1
    return result

def create_array(n):
    mylist=[]
    i=0
    
    while i<n: 
       i += 1
       mylist.append(i)
    return mylist

def create_array(n):
    
# Original code
#    res=[]
#    i=1
#    while i<=n: res+=[i]
#    return res
    
    res=[]
    i=1
    while i<=n:
        #print(i)
        res.append(i)
        i += 1
    return res

def create_array(n):
    res=[]
    i=1
    while i != n + 1: 
        res.append(i)
        i += 1
        
        
    return res


def create_array(n):
    result = [i for i in range(1, n+1)]
    return result

def create_array(n):
     return [int(s)for s in range(n+1)[1:]]

def create_array(n):
    res=[]
    i=1
    while i <= n: 
        print (res)
        res.append(i)
        i += 1
    return (res)

def create_array(n):
    a_list = list(range(1, n + 1 ))
    return a_list

def create_array(n):
    res=[]
    i=1
    while i<=n: 
        res+=[i]
        i=i+1
    return res
print(create_array(5))

def create_array(n):
    res=[]
    i=1
    while i<n+1: 
        res+=[i]
        i+=1
    return res

def create_array(n):
    res=[]
    i=1
    while len(res)!=n: 
        res.append(i)
        i += 1
    return res

def create_array(n):
    res=[]
    i=1
    while i<=n:
        res.append(n)
        n=n-i
    return res[::-1]

create_array = lambda x: list(range(1,x+1))


def create_array(n):
    res=[]
    i=1
    while i<=n: 
        return list(range(1,n+1))

def create_array(n):
    count_list = [i+1 for i in range(n)]
    return count_list


def create_array(n):
    # Define the data structures + variables
    array_list = []
    i = 1
    
    # append value to new list
    while i <= n: 
        array_list.append(i)
        i += 1
        
    return array_list

def create_array(n):
    i,res=1,[]
    while i<=n:
        res.append(i)
        i=i+1
    return res

def create_array(n):
    res=[1]
    i=2
    while max(res) != n: 
        res.append(i)
        i +=1
    return res

def create_array(n):
    count = 0
    new_list = list()
    while(count < n):
        new_list.append(count + 1)
        count += 1
    return new_list

def create_array(n):
    i = 0
    arr = []
    while i <= n -1:
        i += 1
        arr.append(i)
    return arr


def create_array(n):
    a = []
    i = 1
    while i <= n:
        a.append(i)
        i += 1
    return a

def create_array(n):
  i=1
  res=[]
  for k in range (1,n+1):
    res+=[k]
  return res
  
print(create_array(5))

def create_array(n):
    return [*range(1,n+1)]

def create_array(n):
    res=[]
    i=1
    while i<=n: 
      res+=[i]
      print(res)
      i += 1
    return res

def create_array(n):
    r=[]
    i=1
    while i<=n:
        r+=[i]
        i+=1
    return r

def create_array(n):
    res = []
    i = 0
    for i in range (1, n+1): 
        res = res + [i]
    return res   

def create_array(n):
    """
    return list containing 1 to n int
    """
    res=[]
    i=1
    while i<=n: 
        res+=[i]
        i = i + 1
    return res

def create_array(n):
    res=[]
    for e in range(1,n+1):
        res.append(e)
    return res

def create_array(n):
    li = []
    for k in range(1,n+1):
        li.append(k)
    return li

def create_array(n):
    res = []
    i = 0
    while i <= n: 
        i += 1
        res.append(i)
        if i == n:
            return res
        
r = create_array(1)
print(r)

def create_array(n):
    print(n)
    return [i for i in range(1, n+1)]

def create_array(n):
    r = range(1, n+1)
    b = list(r)
    return b

def create_array(n):
    result = []
    count = 1
    for x in range(0, n):
        result.append(count)
        count += 1
    return result

def create_array(n):
    res=[]
    i=1
    while i<=n:
        res.append(i)
        if i <= n:
            i += 1
    return res


def create_array(n):
    res = []
    i = 1
    while i <= n:
        res += [i]
        i = i + 1
    print(res)
    return res

def create_array(n):
    res=[]
    i=1
    while i<=n: 
        res+=[i]
        i +=1
    return res
    # return [i for i in range(1,n+1)]  


def create_array(n):
    res=[]
    i=1
    for x in range(1,n+1):
        if i<=n: res+=[x]
    return res

def create_array(number):
    res=[]
    i=1
    while number>=i: res+=[i]; i+=1
    return res

def create_array(n):
    res = []
    i = 1
    while i <= n: 
      for i in range(i, n+1):
          res += [i]
      if len(res) == n:
        break
    return res

def create_array(n):
    res=[1+i for i in range(n)];
    return res

def create_array(n):
    res=[]
    i=1
    while i<=n: 
        res+=[i] #res.append(i)
        i+= 1
    return res

def create_array(n):
    res=[]
    i=1
    for i in range(1,n+1):
        if i<=n: res+=[i]
    return res

def create_array(n):
    lista = []
    for i in range(n):
        lista.append(n)
        n = n - 1
    lista.reverse()
    return lista
    


def create_array(n):
    return [idx + 1 for idx in range(n)]

def create_array(n):
    s = []
    for i in range(1,n+1):
        s.append(i)
    return s

create_array = lambda n:[i for i in range(1, n + 1)]

def create_array(n):
    res=[]
    i=1
    while i<=n: 
        res+=[i]
        #print(res)
        i=i+1
    return res

def create_array(n):
    """
    res = []
    i = 1
    while i <= n: 
        res += [i]
        i += 1    
    return res
    """
    
    return [i for i in range(1, n+1)]

def create_array(n):
    res=[]
    i = 0
    while len(res) < n:
        i += 1
        res.append(i)
    return res

def create_array(n):
    res = []
    i = 1
    while n > len(res):
        res.append(i)
        i += 1
    return res
print(create_array(5))

def create_array(n):
    new_array = []
    num = 0
    for el in range(0, n):
        num += 1
        new_array.append(num)
    return new_array

def create_array(n):
    return [n + 1 for n in range(n)]

def create_array(n):
    res=[]
    i = 0
    while i<=n:
        for i in range(1,n+1):
            res.append(i)
        return list(res)

create_array=lambda n: [*range(1,n+1)]

def create_array(n):
    a=range(1,n+1)
    tab=[]
    for x in a:
        tab.append(x)
    
    return tab

def create_array(n):
    res=[]
    i=0
    while i!=n: 
      i=i+1
      res.append(i)
    return res

def create_array(num):

    result = []
    count = 1

    while count <= num:
        result.append(count)
        count += 1

    return result

def create_array(n):
    res=[]
    i=0
    for element in range(1, n+1):
        res.append(element)
    return res

def create_array(n):
    res=[]                  #initialize an empty list
    i=1                     #set i to equal 1
    while i <= n:           #initialize while loop  
        res += [i]          #add i to empty list
        i += 1              #incriment i by 1          
    return res              #return res as populated list


def create_array(n):
    return list([x+1 for x in range(n)])

def create_array(n):
    res, i = [], 1
    while i <= n: res += [i]; i += 1
    return res

def create_array(n):
    res=[]
    i=1
    while i< n:
        res.append(i)
        i += 1
    res.append(i)
    return res

def create_array(n):
    g=([])
    for x in range(n):
        g.append(x)
    
    g.append(n)
    return g[1:]


def create_array(n):
    i=1
    res=[1]
    while len(res)<n: 
        i += 1
        res.append(i)
    return res

def create_array(n):
    return [i for i in range(1, 1 + n)]

def create_array(n):
  a  = n+1
  arr = [i for i in range(1,a)]
  return arr

def create_array(n):
    res=[]
    i=1
    while i<=n: 
        res.append(i)
        i+=1
    return list(res)

def create_array(n):
    return list(i+1 for i in range(n))

def create_array(n):
    return [each+1 for each in range(n)]

def create_array(n):
    a=[]
    for i in range(1,n+1):
        a.append(i)
    return(a)

def create_array(n):
    res=[]
    i=1
    if i<=n:
        for i in range(n):
            res = res + [i+1]
    return res


def create_array(n):
    res=[]
    i=1
    while i<=n: 
        res+=[i]
        i+=1
    return res
#Completed by Ammar on 3/9/2019 at 02:13AM.


def create_array(n):
    return [e for e in range(1,n+1)]

#def create_array(n):
#    res=[]
#    i=1
#    while i<=n: res+=[i]
#    return res

def create_array(n):
    res = []
    i=1
    while i<=n:
        res+=[i]
        i +=1
    return res
        


def create_array(n):
    r, i = [], 1
    while i <= n:
        r += [i]
        i += 1
    return r

def create_array(n):
    res=[]
    i=1
    while i<=n:
        print(i)
        res.append(i)
        i+=1
    return res

def create_array(n = 0):
  res = []
  
  for i in range(1, n + 1):
    res += [i]
  
  return res


def create_array(n):
    res=[]
    i=1
    while i<=n: 
        res+=[i] 
        i+=1
    return res  #I solved this Kata on  7/29/2019  04:16 AM...#Hussam'sCodingDiary

def create_array(n):
    res=[]
    i=0
    while i<n: 
        i = i + 1 
        res +=[i]
    return res

def create_array(n):
    return [num + 1 for num in range(n)]

def create_array(n):
    res=[]
    i=0
    while i<=n: 
        i += 1
        res+=[i]
        if (len(res) == n):
            break
    return res

def create_array(n):
    return list(range(1,int(n)+1))

def create_array(n):
    res=[]
    i=1
    while i<=n: 
        i = i+1
        res+=[i-1]
    return res

def create_array(n):
    print(n)
    res = []
    #res=[]
    i=1
    while i<=n:
        res+=[i]
        i +=1
    return res

def create_array(n):
    res=[x+1 for x in range(n)]
    return res

def create_array(n):
    """
    return a array with n elements
    :param n: array length
    :return:
    """
    ret = []
    for i in range(n):
        ret.append(i+1)
    return ret

def create_array(num):
    array = []
    i = 1
    while num >= i:
        array.append(i)
        i += 1
    return array
    
print(create_array(5))    

def create_array(n):
    arr = []
    for x in range(n):
        arr.append(x+1)
    return arr

def create_array(n):
    res=[]
    i=0
    while i<n:
        res.append(i+1)
        i=i+1
    return res

def create_array(n):
    res=[]
    i=1
    for i in range(i,n+1):
        res.append(i)
    return res

#Unfinished Loop - Bug Fixing #1
def create_array(n):
    res=[]
    i=1
    while i<=n: 
        res+=[i]
        i = i+1
    return res

def create_array(n):
    res=[]
    while n>=1:
        res.append(str(n))
        n-=1
    k=[int(i) for i in res]
    k.sort()
    return k

def create_array(n):
    res=[]
    i=1
    for x in range(n):
        res.append(i)
        i += 1
        
    return res