Trying to understand nested loops

ojomooluwatolami675 at gmail.com ojomooluwatolami675 at gmail.com
Fri Aug 5 03:34:45 EDT 2022


Hello, I’m new to learning python and I stumbled upon a question nested loops. This is the question below. Can you please how they arrived at 9 as the answer. Thanks 

var = 0
for i in range(3):
  for j in range(-2,-7,-2):
    var += 1
     print(var)

Sent from my iPhone


More information about the Python-list mailing list