esult = 0 for i in range(5): result += i print(result) 输出结果为( )
举一反三
- 下列程序的输出结果是:sum = 0 def sum(i1, i2): result = 0 for i in range(i1, i2 + 1): result += i return result print sum(1, 10)
- 以下代码的运行结果为 def calculate(number): result = 0 i = 1 while i <= number: result = result + i i += 1 return result result = calculate(100) print('1~100的累积和为:', result)
- 下列语句的执行结果是: result = 0 i = 1 while result <; 10: result += i i += 1 if i >; 2: break print(result) A: 3 B: 5 C: 7 D: 10
- 下面程序段的输出结果是( )。 public class Test public static void main ( String[] args) int result=0; for ( int i=1;i<=5;i++) if ( i%2==0 ) continue; result + =i; System. out. println ("result is " + result ); A: result is 7 B: result is 8 C: result is 9 D: result is 10
- 下列程序段的输出结果是___________。for i in range(5):if i%2 == 0:print(i)else:print(i)