+ 1
Why no output on this code?
a = 1 while a >1 and a<10: print(a) a +=1 Why I can't get any output? I'll get output just if on second line I'll change a>=1.
10 ответов
+ 6
because a is not greater than 1
+ 4
Because as your using "and" both conditions should be satisfied.And the first condition is failed because "a" should be a>=1.
+ 3
1 is equal to 1 but it's not greater than 1
+ 2
Python uses indentation (white space at the beginning of a line) to delimit blocks of code.
And a > 1 rerurns false. You can change a or change the condition.
a = 1
while a >= 1 and a < 10:
print(a)
a += 1
+ 2
maklaudas
to ping someone: @Username :)
+ 2
Since a=1, it won't meet the condition of a>1, therefore bringing no output. But if you changed the value for a(a=2)or edited the condition/argument(a>=1), there will be 9 outputs until it stops.
A little advice from a learner.
+ 1
0
Yes, I know about indentation just mistaken here to write correct 😁 but my question, why not execute a>1 and starts work when I change to a >=1?