Could someone explain me why the output is 22 here:
def fun(): for x in range(22,23,24): print(x) fun()
The syntax for range is
range(start, stop, step)
The range of numbers to be printed starts from
23 (end point not included), in steps of
The first number is
22, which gets printed.
The next number will be
46, which is greater than
23, so it doesn’t get printed and the loop terminates.
Answered By – Deepthi Tabitha Bennet
Answer Checked By – Mary Flores (AngularFixing Volunteer)