Post

Python Developer
Python Developer@Python_Dv·
Comment below the output! 😃👇
Python Developer tweet media
English
32
5
123
10.4K
Earnest Codes
Earnest Codes@Earnesto037·
@Python_Dv Answer: A) 1 Explanation The variable x is initialized to 5.The while loop condition x > 2 is checked:First iteration: (5>2) is true. x becomes (5-2=3).Second iteration: (3>2) is true. x becomes (3-2=1).Third iteration: (1>2) is false. The loop terminates.
English
0
0
11
655
Kamal Gurjar
Kamal Gurjar@KamalGurjar8·
@Python_Dv Answer: A) 1 Explanation: Start with x = 5. Loop runs while x > 2. 5 → subtract 2 → 3 3 → subtract 2 → 1 1 is not greater than 2, so the loop stops print(x) runs after the loop, so the output is 1.
English
0
0
10
850
Premakumar Thevathasan (Prem Iyer)
Premakumar Thevathasan (Prem Iyer)@KumarT00623760·
@Python_Dv Code had used the same variable (lowercase x throughout): Start: x = 5 First Pass: 5 > 2 is true. x becomes 3. Second Pass: 3 > 2 is true. x becomes 1. Third Pass: 1 > 2 is false. Loop ends. Final Print: It would print 1. For More Reference =>>
Premakumar Thevathasan (Prem Iyer) tweet media
English
0
0
5
444
Prime Dev Digital Lab
Prime Dev Digital Lab@ODINAKA_ODINAKA·
@Python_Dv A) 1. While loop only breaks when the condition is false. 5 greater than 2 = True, loop continues, x -= 2 means subtract 2 from x if x is greater than 2, so x becomes 3. 3 greater than 2 is True, x -= 2, x becomes 1. 1 greater than 2 = False the loop breaks and prints 1.
English
0
0
1
330
Biel Men
Biel Men@BielMenHaha·
@Python_Dv Will just print 1, because 1<2 and in every cicle the variable decreases 2. The while doesn't run when x<2, and the print occurs after it.
English
1
0
0
92
Paylaş