+ 1
Why the answer is 4 ?
It asks what is the answer i = 3 While i >=0 i = i - 1 Print(i) And it says the answer is 4
7 Respostas
+ 5
The code you supplied here gives -1 as result.
+ 3
Maybe 4 is how many times a number is printed: 2 1 0 -1
+ 2
It can't be 4, because i gets lower not higher, so in the last loop we have:
i = 0 (condition is satisfied)
i = i - 1 ( so i = -1 )
And it stops there, output is -1, run it again.
+ 2
We can't know the answer to a question you haven't provided... what was the question ?
+ 1
But it says the answer is 4
With out the answer 4 I can not go farther and it's not accepting any other answer
+ 1
Can you give us the specific question? Is it asking for what i is after the loop is done or how many times the while iterates through it?
0
If it comes from a challenge in sololearn, you can report the bad answer.