- 3

What its coding in python?

Output 1010101 10101 101 1

19th Jan 2020, 5:05 PM
Manpreet Singh
Manpreet Singh - avatar
5 ответов
+ 6
Please try to solve this task (homework?) on your own and show us your attempt!
19th Jan 2020, 5:07 PM
HonFu
HonFu - avatar
0
i=7 while i<=7: print('10'*i) i=i-2 That's my try
19th Jan 2020, 5:16 PM
Manpreet Singh
Manpreet Singh - avatar
0
And what happens when you run that? What output do you get?
19th Jan 2020, 6:25 PM
HonFu
HonFu - avatar
0
10101010101010 1010101010 101010 10
20th Jan 2020, 2:14 AM
Manpreet Singh
Manpreet Singh - avatar
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!
20th Jan 2020, 8:48 AM
HonFu
HonFu - avatar