Intro Python Syntax
loop + range + printing
Use a loop
def loop(num):
for x in range(num):
print(x)
loop(5)
recursion
def loop(num):
print(num)
if num == 0:
return num
else:
loop (num = num - 1)
loop(5)
counter + default or multiple parameters + recursion
def double_array(array, index=0):
if index >- len(array)
return
array[index] *= 2
double(array, index + 1)
for default
double_array([1,2,3,4,5])
for multiple
double_array([1,2,3,4,5], 0)