Post

Allen Floyd
Allen Floyd@alfloyd71·
@Python_Dv 18 is the value of x after the last iteration, which occurs just before x becomes greater than 20.
English
0
0
1
174
Shiloh Egwuatu
Shiloh Egwuatu@ShiloheAi·
@Python_Dv The loop keeps adding 3 until x < 20 is false. At x = 18, it adds 3 → x = 21. Now 21 < 20 is false, loop ends, and print shows 21. Right now the loop overshoots because it does the x+=3 before the check stops. To print the highest value of x (a multiple of 3) less than 20...
English
1
0
0
33
Damian
Damian@IAconDamian·
@Python_Dv El bucle empieza con x = 0 y va sumando de 3 en 3 mientras x < 20. Entonces queda así: 0 → 3 → 6 → 9 → 12 → 15 → 18 → 21 Cuando llega a 21 ya no cumple la condición (x < 20) y ahí se detiene Por eso al final imprime 21. La opción correcta es la 4.
Español
0
0
0
85
Allen Floyd
Allen Floyd@alfloyd71·
@Python_Dv This is a tricky one that hinges on the placement of the printed output; the correct answer is 21 since x is printed after the while loop, whereas if it had been printed at the beginning of the loop, the last printed output would have been 18.
English
0
0
0
173
Ajeet
Ajeet@buildwithajeet·
@Python_Dv The correct answer is 21 because the last iteration of x is 18 then 18 + 3 = 21 and 21 is greater than 20.
English
0
0
0
7
Natifella
Natifella@Natifella1·
@Python_Dv Option 4: x = 21. The While statement will go up to x = 18 < 20 and increment by 3 giving x = 21 which makes the 'while x < 20' = False, exiting the 'while' block and moving on to 'print' statement
English
0
0
0
6
laso
laso@lasitolas·
@Python_Dv 4. 21 satisfies the loop condition
English
0
0
0
54
Tsukuyomi
Tsukuyomi@0xtsk·
@Python_Dv python code? more like python riddle. let's see who cracks it first. but remember, even a broken code can run... sometimes. 🐍
English
0
0
0
2
TechLatest.Net
TechLatest.Net@TechlatestNet·
@Python_Dv Insightful update, thanks for explaining things so clearly.
English
0
0
0
138
Paylaş