Kodewick
Start learning →
Basic←→0 / 100

Tiling a square

#019BasicLoopsNumbers4 min

A square of tiles with a side of k uses k × k tiles. Write side_for(n) to return the smallest side k so that k × k is more than n.

Examples
side_for(10)→4
side_for(16)→5
main.py
def side_for(n):
    k = 1
    # your code here: while k × k is not big enough, add 1 to k

    return k
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.