0
# the answer key
for num in range(-10, 0, 1):
    print(num)

I wanted to see if I could find a way to do it without using range():

i = -1
while abs(i) <= 10:
    print(i)

I'm new to python.

Thank you.

Antonio
  • 417
  • 2
  • 8

1 Answers1

1

You mean this? It will mimic the range version you have in the question. Printing from -10 to -1 in increments of 1

i = -10
while i < 0:
    print(i)
    i += 1
S.D.
  • 2,486
  • 1
  • 16
  • 23