How many times will the following while loop execute? [br][/br]k = 50 [br][/br]while k > 1: [br][/br]print(k) [br][/br]k = k // 2
A: 5
B: 3
C: 4
D: 6
A: 5
B: 3
C: 4
D: 6
举一反三
- How many times is the loop body " k++;"<br/>executed in the following program segment? ( )<br/>int k=0; while(k=1)<br/>k++; A: Infinite B: 1 C: 0 D: compile error
- If k is integer, how many times will the following "while" loop be executed?k = 50 while k >; 1: print(k) k = k // 2 A: 3 B: 4 C: 5 D: 6
- 给出下面代码:[br][/br] k=10000[br][/br] while k>1:[br][/br] print(k)[br][/br] k=k/2[br][/br]上述程序的运行次数是:[br][/br](1.7) A: 1000 B: 13 C: 15 D: 14
- If k is integer, how many times will the following "while" loop be executed?k = 50 while k > 1: print(k) k = k // 2 A: 3 B: 4 C: 5 D: 6
- k = 0[br][/br]while True:[br][/br] s = input('请输入 q 退出: ')[br][/br] if s == 'q':[br][/br] k += 1[br][/br] continue[br][/br] else:[br][/br] k += 2[br][/br] break[br][/br]print(k) [br][/br] [br][/br] [br][/br] 使用 A: 2 B: 请输入 q 退出: C: 3 D: 1