1

I want to change the value of the index of the for loop inside the loop with an if statement.

for i in range(0,10):
    print(i)
    if i==5:
    i=10

The result is

0
1
2
3
4
5
6
7
8
9

What I am expecting is:

0
1
2
3
4
5
Mazdak
  • 105,000
  • 18
  • 159
  • 188
Dean
  • 13
  • 4

0 Answers0