a=0print(a,end="")s=0while a[10: a=a+1 if a**2]50: continue s=s+aelse: print(s)
028
举一反三
- 【其它】写出并理解下列语句输出的结果 s = "hello" print(s[0]) print(s[4]) print(s[-1]) print(s[0:3]) print(s[0:4:2]) print(s[:]) print(s[:3]) print(s[::-1]) print(s[1:])
- 有如下程序段:s = 0For i = 1 To 10 s = s + iNext iPrint s与上述程序段输出结果相同的程序段为( )。 A: s = 0: i = 0 While i <= 10 i = i + 1 s = s + i Wend Print s B: s = 0: i = 1 While i < 10 i = i + 1 s = s + i Wend Print s C: s = 0: i = 1 Do s = s + i i = i + 1 Loop While i < 10 Print s D: s = 0: i = 1 Do s = s + i i = i + 1 Loop Until i > 10 Print s
- 下面程序计算并输出的是_______。 Private Sub Command1_Click() a=10 s=0 Do s=s+a*a*a a=a-1 Loop Until a<=0 Print s End Sub
- 16、下面程序的执行结果是______________。(1275) s = 0 for i in range(1,101): s += i if i == 50: print(s) break else: print(1)
- s = "Python", 能够显示输出Python 的选项是:()。 A: print s[0:-1] B: print s[-1:0] C: print s[:5] D: print s[:]
内容
- 0
s = " Python", 能够原样显示输出变量s值的选项是: A: print(s[:6]) B: print(s[-1:0]) C: print(s[:]) D: print(s[0:-1])
- 1
下面代码的输出结果是()。 s=0 while(s<=1): print(‘计数:’,s) s=s+1
- 2
以下程序会报错的是( )。 A: s = ["a", "b", "c"] print(s[1]) B: s = ("a", "b", "c") print(s[1]) C: s = {"a", "b", "c"} print(s[1]) D: s = {0:"a", 1:"b", 2:"c"} print(s[1])
- 3
下列程序输出结果是______。 i=3 s=0 while i<10: i=i+1 if i%3: continue s=s+i print(s) A: 52 B: 49 C: 15 D: 0
- 4
下列程序段执行的结果是()。 declare @s as int,@i as int set @s=0 set @i=1 while @i<=10 begin if @i%3=0 begin set @i=@i+2 continue end set @s=@s+@i set @i=@i+2 end print @s A: 55 B: 25 C: 13 D: 12