• 2021-04-14
    def sum_func(*args):
    sm = 0
    for i in args:
    sm += i
    return sm
    print(sum_func(1,2,3,7,4,5,6))
    以上程序执行结果为
  • 28

    内容

    • 0

      下面代码的输出结果为( ) for i in range(1, 7): if i % 2 == 0: print(i, end=" ") A: 1 2 3 4 5 6 7 B: 1 2 3 4 5 6 C: 2 4 6 7 D: 2 4 6

    • 1

      下列程序执行后,sum的结果是________。Dim sum As IntegerFor i = 1 To 4 Step 2 For j = 1 To i Step 2 sum += j NextNext A: 6 B: 9 C: 5 D: 7

    • 2

      已知函数定义def func(* p) :return sum(p),那么表达式func(1,2,3)的值为

    • 3

      ‍下列程序的执行结果是( ).​‍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

    • 4

      下列函数int func ( int n ){ int i = 0, sum = 0;while ( sum <; n ) sum += ++i;return i;}的时间复杂度是 A: O(nlogn) B: O(n) C: O(n1/2) D: O(logn)