Skip to content

Latest commit

 

History

History
42 lines (26 loc) · 514 Bytes

Unfinished_Loop_Bug_Fixing_1.md

File metadata and controls

42 lines (26 loc) · 514 Bytes

CodeWars Python Solutions


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!


Given Code

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

Solution

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

See on CodeWars.com