i = -6
# Code the while loop
while i != 0 :
print("Output 1")
if i>0 :
print("Output 2")
else :
print("Output 3")
print(offset)
Problem with the code is
1. there is no change of value for the variable i in the loop
So, loop runs infinitely
2. offset is not a variable
So, out it in quotes
FIX:
i = -6
# Code the while loop
while i != 0 :
print("Output 1")
if i>0 :
print("Output 2")
else :
print("Output 3")
i += 1
print("offset")
Get Answers For Free
Most questions answered within 1 hours.