A: 00
B: 01
C: 22
D: 02
举一反三
- for i in range(4): if i%2==0: print(i) break print(i) 结果是
- 编写一段代码使用for循环输出1~10之内的奇数,以下哪些选项的结果是正确的?( ) A: for i in range(10): if i % 2 == 1: print(i) B: for i in range(9): if i % 2 == 0: print(i) C: for i in range(11): if i % 2 == 1: print(i) D: for i in range(12): if i % 2 = 0: print(i)
- 下列程序的执行结果是( ).for i in range(2): print(i,end=' ' )for I in range(4,6): print(I,end=' ' ) A: 2 4 6 B: 0 1 2 4 5 6 C: 0 1 0 1 2 3 D: 0 1 4 5
- for i in range(1,5): if i%2==0: print(i) break
- 下面代码的运行结果是:for i in range(2):print(i, end='')else:print(0) A: 010 B: 012 C: 0102 D: 01
内容
- 0
已知字符“▼”的Unicode码位为“25BC”。下面的代码,能够正确输出如下图形的是( )。[img=116x123]18032de2fb12d29.png[/img]知识点:for循环。 A: for i in range(4, 0, -1): print(" "*(4-i)+"\u25BC"*(2*i-1)) B: for i in range(4): print(" "*i+"\u25BC"*(7-2*i)) C: for i in range(4): for j in range(i): print(" ",end="") for j in range(7-2*i): print("\u25BC",end="") print() D: for i in range(4): print(" "*(4-i)+"\u25BC"*(2*i-1))
- 1
(多选)已知字符“▼”的Unicode码位为“25BC”。下面的代码,能够正确输出如下图形的是( )。[img=116x123]17e0c817ca58112.png[/img]知识点:for循环。 A: for i in range(4):for j in range(i):print(" ",end="")for j in range(7-2*i):print("\u25BC",end="")print() B: for i in range(4, 0, -1):print(" "*(4-i)+"\u25BC"*(2*i-1)) C: for i in range(4):print(" "*i+"\u25BC"*(7-2*i)) D: for i in range(4):print(" "*(4-i)+"\u25BC"*(2*i-1))
- 2
将300~400不能被3整除的数输出。下列哪段代码正确 A: for i in range (300,401):if i%3==0 continue print i B: for i in range (299,401):print i, if i%3==0 continue print i C: for i in range (300,400):if i%3==0 continue print i D: for i in range (301,401): if i%3==0 continue print i
- 3
下列语句的执行结果是: for i in range(10): if i % 4 == 0: print(i) continue break A: 0 B: 2 C: 4 D: 8
- 4
下列程序段的输出结果是___________。for i in range(5):if i%2 == 0:print(i)else:print(i)