- 3
What its coding in python?
Output 1010101 10101 101 1
5 ответов
+ 6
Please try to solve this task (homework?) on your own and show us your attempt!
0
i=7
while i<=7:
print('10'*i)
i=i-2
That's my try
0
And what happens when you run that? What output do you get?
0
10101010101010
1010101010
101010
10
0
You have written 'as long as i is lower or equal than 7'. Then you lower i in the body. Which means that the loop will never stop.
The 1 at the end is missing.
The lines shrink by too much each time.
Now how to solve these problems? Think hard!