Which of the following Python loops will have exactly 10 iterations? Select all which apply.多项选择题

A
a. i = 1014 while i >= 1: if i % 2 == 0: i = i/2 else: 3*i + 1 print(i)
B
b. array = np.arange(0, 20) for i in array[::2]: print(i)
C
c. i=1 while i < 10: i = i + 1 print(i)
D
d. i= 0 while i < 310 and i != 5: if i % 2 == 0: i = 2*i + 1 else: i = i + 9 print(i)
E
e. for i in range(9, -1, -1): print(i)
登录即可查看完整答案
我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。
类似问题
What is the value of q after the final iteration of the inner most loop when i=30 and k=-3? for i in range(40): j = 4 for k in range(5,-5,-1): s = 5 + j + k for x in range(5,-9,-3): q = -x*s
How many times is the while loop run during the final iteration of the for loop? for i in range(5,1,-1): k = -5 while k < i: k = k + 1 i = i - 1
What is the value of k after the following Python code? k=0 j=1 for i in range(5): while j < i: k += 1
What is the value of p after two iterations of the following loop? p = 1 for k in range(0,100,2): p = k**0.5 p += 3
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!