+ 1
Change the following Python code from a For loop to a While loop:
for i in range (1,10) Print(i)
2 Réponses
+ 2
You have one variable in your for loop. How is it possible to come up with two variables in your while loop... ? You've probably mistaken x as i (?).
range goes from 1 (1, inclusive) to 9 (10, exclusive). The more accurate representation in while loop syntax would be:
i = 1
while i < 10:
print(i)
i += 1
+ 1
How about this....
i=o
While i<9
x+=1
Print(x)