def reverse_list(l):
    if len(l) == 0:
        return []
    return l[-1] + reverse_list(l[1:])

Recursively reverse a list of elements.


def reverse_list(l):
    if len(l) == 0:
        return []
    return l[-1].append(reverse_list(l[1:]))

Recursively reverse a list of elements.


def reverse_list(l):
    if len(l) == 0:
        return []
    return reverse_list(l[-1]).append(l[:-1])

Recursively reverse a list of elements.


def reverse_list(l):
    if len(l) == 0:
        return l
    return reverse_list(l[-1]).append(l[:-1])

Recursively reverse a list of elements.


def reverse_list(l=[]):
    if len(l) == 0:
        return l
    return reverse_list(l[-1]).append(l[:-1])

Recursively reverse a list of elements.


def reverse_list(l):
    return reverse_list(l[-1]).append(l[:-1])

Recursively reverse a list of elements.


def minimum(l, min):
    if not l:
        return []
    return minimum(l[1:], l[0] if l[0] < val else val)

Return the minimum element in a list of numbers.


def minimum(l, min):
    if not l:
        return []
    return minimum(l[1:], l[0] if l[0] < min else min)


def minimum(l):
    min = None
    if not l:
        return []
    return minimum(l[-1] if l[-1] < min else min)


def minimum(l):
    if not l:
        return []
    return minimum(min(l[:-1]))


def minimum(l=[]):
    if not l:
        return []
    return minimum(min(l[:-1]))


def minimum(l):
    if not l:
        return []
    return minimum(min(l))


def factorial(n):
    A = 'fact.c'
    with open(A, 'w') as f:
        f.write(s.format(n))
    with open('stdout.txt', 'w+') as f:
        subprocess.run(['gcc', A, '-o', 'out.o'])
        subprocess.run(['./out.o'], stdout=f)
        f.seek(0)
        return int(f.readline())

assert factorial(-1)==1 and factorial(0)==1 and factorial(1)==1 and factorial(2)==2 and factorial(5)==120 and factorial(20)==2432902008176640000

Compute the factorial of the given number.


Recursively reverse a list of elements.


def reverse_list(l=None):
    if len(l) == 0:
        return l
    return reverse_list(l[-1]).append(l[:-1])

Recursively reverse a list of elements.


def reverse_list(l):
    if l == None:
        return l
    return reverse_list(l[-1]).append(l[:-1])

Recursively reverse a list of elements.


def minimum(l, n):
    if n == 0:
        return l[0]
    min = minimum(l[1:], n - 1)
    if l[0] < min:
        return l[0]
    else:
        return min


def minimum(l, n=0):
    if n == 0:
        return l[0]
    min = minimum(l[1:], n - 1)
    if l[0] < min:
        return l[0]
    else:
        return min


def minimum(l, n=0):
    min = minimum(l[1:], n - 1)
    if l[0] < min:
        return l[0]
    else:
        return min


def minimum(l, n=0):
    if l == None:
        return l
    min = minimum(l[1:], n - 1)
    if l[0] < min:
        return l[0]
    else:
        return min


def minimum(l):
    if len(l) == 0:
        return l[0]
    min = minimum(l[1:])
    if l[0] < min:
        return l[0]
    else:
        return min


def minimum(l):
    if len(l) == 0:
        return l
    min = minimum(l[1:])
    if l[0] < min:
        return l[0]
    else:
        return min


def minimum(l):
    if len(l) == 1:
        return l[0]
    min = minimum(l[1:])
    if l[0] < min:
        return l[0]
    else:
        return min


def maximum(l):
    if len(l) == 1:
        return l[0]
    max = maximum(l[1:])
    if l[0] > max:
        return l[0]
    else:
        return max

Return the maximum element in a list of numbers.


def reverse_list(l):
    if len(l) == 1:
        return l[0]
    return reverse_list(l[-1]).append(l[:-1])

Recursively reverse a list of elements.


def reverse_list(l):
    if len(l) == 1:
        return l[0]
    return reverse_list(l[:-1]).append(-1)

Recursively reverse a list of elements.


def reverse_list(l):
    if len(l) == 1:
        return l[0]
    return l[-1] + reverse_list(l[:-1])

Recursively reverse a list of elements.


def reverse_list(l):
    if len(l) == 1:
        return l[0]
    return reverse_list(l[:-1].append(l[-1]))

Recursively reverse a list of elements.


def reverse_list(l):
    if not l:
        return l
    return reverse_list(l[:-1].append(l[-1]))

Recursively reverse a list of elements.


def reverse_list(l):
    if not l:
        return l
    return reverse_list(l[1:].append(l[0]))

Recursively reverse a list of elements.


def reverse_list(l):
    if not l:
        return []
    return reverse_list(l[1:].append(l[0]))

Recursively reverse a list of elements.


def reverse_list(l):
    if len(l) == 1:
        return l[0]
    return reverse_list(l[1:].append(l[0]))

Recursively reverse a list of elements.


def reverse_list(l):
    if not l:
        return l[0]
    return reverse_list(l[1:].append(l[0]))

Recursively reverse a list of elements.


Recursively reverse a list of elements.


def square_area(n):
    sq = n * n
    return sq

assert square_area(0)==0 and square_area(21138)==446815044

Return the area of a square.


Return the area of a square.


def square_area(n):
    result = n * n
    return result

Return the area of a square.


def square_perimeter(n):
    result = 2 * (n + n)
    print(result)

assert square_perimeter(0)==0 and square_perimeter(-12684)==-50736

Returns the perimeter of a square.


def rectangle_perimeter(n, m):
    result = 2 * (n + m)
    return result

Return the perimeter of a rectangle with the given coordinates.


def circle_area(n):
    result = 3.14 * n ** 2
    print(result)

Return the area of a circle.


def square_perimeter(n):
    result = 2 * (n + n)
    return result

Returns the perimeter of a square.


def circle_area(n):
    result = 3.14 * n ** 2
    return result

Return the area of a circle.


Return the area of a circle.


Returns the perimeter of a square.


def swap(a, i, j):
    tmp = a[i]
    a[i] = a[j]
    a[j] = tmp

def find_position_of_smallest(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j = j + 1
    return p

def sort(a):
    i = 0
    while i < len(a):
        p = find_position_of_smallest(a, i)
        swap(a, i, p)
        i = i + 1

assert sort([0])==None and sort([0])==None and sort([])==None and sort([])==None and sort([' '])==None and sort([' '])==None and sort([70, 339305549])==None and sort([70, 339305549])==None

Sort a list by repeatedly moving the minimimum of the remaining sublist to the front.


def reverse(a):
    a = a[::-1]
    return a

Reverse a list of elements by swapping its elements.


assert double(0)==0 and double(-7601)==-15202

Double a number or a string.


Double a number or a string.


Return the area of a circle with the given coordinates.


def circumference(r):
    return 2 * (3.141 * r)

assert circumference(0)==0.0 and circumference(-23091)==-145057.662

Return the circumference of a circle.


def circumference(r):
    return 2 * (pi * r)

Return the circumference of a circle.


Return the circumference of a circle.


def circumference(r):
    return 2 * pi * r

Return the circumference of a circle.


def circumference(r):
    return 2 * 3.141 * r

Return the circumference of a circle.


def reverse(a):
    i = 0
    while i < len(a) / 2:
        a[len(a) - i - 1], a[i] = a[i], a[len(a) - i - 1]
        i += 1
    return a


def swap(a, i, j):
    a[i], a[j] = a[j], a[i]
    return a

def find_smallest_position(a, i):
    p = i
    j += 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j += 1
    return p

def selection_sort(a):
    i = 0
    while i < len(a):
        p = find_smallest_position(a, i)
        swap(a, i, j)
        i += 1
    return a

Sort a list by repeatedly move minimimum of remaining sublist to front.


def swap(a, i, j):
    a[i], a[j] = a[j], a[i]
    return a

def find_smallest_position(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j += 1
    return p

def selection_sort(a):
    i = 0
    while i < len(a):
        p = find_smallest_position(a, i)
        swap(a, i, j)
        i += 1
    return a


def find_smallest_position(a, i):
    p = i
    j = i + 1
    while j < len(a):
        if a[j] < a[p]:
            p = j
        j += 1
    return p

def swap(a, i, j):
    a[i], a[j] = a[j], a[i]
    return a

def selection_sort(a):
    i = 0
    while i < len(a):
        p = find_smallest_position(a, i)
        swap(a, i, j)
        i += 1
    return a


def selection_sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j += 1
        a[i], a[j] = a[j], a[i]
        i += 1
    return a


def selection_sort(a):
    i = 0
    while i < len(a):
        p = i
        j = i + 1
        while j < len(a):
            if a[j] < a[p]:
                p = j
            j += 1
        tmp = a[p]
        a[p] = a[i]
        a[i] = tmp
        i += 1
    return a


def bsearch(a, q):
    low = 0
    high = len(a)
    while low < high:
        mid = (low + high) / 2
        if a[mid] < q:
            low = mid + 1
        else:
            high = mid
    return low

Search for element q in the sorted array a.