Time complexity of nested loops help
Solution 01) Analysis what code does.

Your code execute the first loop n times.

And for each executions on first loop it will execute n times.

So the result will be n * n = n^2

Solution 02)
Try to count how many times execute the instruction

def f(n):
count = 0
i = 0
  while i &lt; n:
   j = 0
     while j &lt; n:
      j = j + 1
      print("execute:" + count)
      count = count + 1
 i = i + 1