已知字符“▼”的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))
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))
举一反三
- (多选)已知字符“▼”的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))
- 下列程序的执行结果是( ).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循环输出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(4): if i%2==0: print(i) break print(i) 结果是
- 下面代码中输出结果为0、1、2三个数字的有(_____)。 A: for i in range(3): print(i) B: i=1 while i<3: print(i) i+=1 C: i=3 while i>1: i=i-1 print(3-i) D: for i in range(3,0,-1): print(3-i)