Problem SolvingWhat will be the output of the following program?def sum(*args): '''Function returns the sum of all values''' result = 0 for i in args: result += i return resultprint(sum.__doc__)print(sum(4, 5, 6, 5))print(sum(5, 6, 20, 4, 5))Select all the correct statements given below.OptionsFunction returns the sum of all values203020302040Function returns the sum of all values2040
Question
Problem SolvingWhat will be the output of the following program?def sum(*args): '''Function returns the sum of all values''' result = 0 for i in args: result += i return resultprint(sum.doc)print(sum(4, 5, 6, 5))print(sum(5, 6, 20, 4, 5))Select all the correct statements given below.OptionsFunction returns the sum of all values203020302040Function returns the sum of all values2040
Solution
The correct statements are:
- Function returns the sum of all values
- 20
- 40
Similar Questions
What will be the output after the following statements?a = list(range(0,10,3)) print(sum(a))Options101830100
What will be the output after the following statements?a = [1, 2, 3] print(sum(a))Options3162
Choose the Correct Answer(s)What will be the output after the following statements?a = list(range(-10,5,2)) print(sum(a))Options-2402420
What will be the output of the following Python code?def foo(): total += 1 return totaltotal = 0print(foo())
What will be the output of the following Python code?m = 3 def ct1(): global m m = 1def ct2(p,q): global m return p+q+mct1()sum = ct2(2,4)print(sum)OptionsError7910
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.