108,938 views
13 votes
13 votes
What will be printed to the screen when the following program is run?

What will be printed to the screen when the following program is run?-example-1
User Abraham D Flaxman
by
3.4k points

2 Answers

18 votes
18 votes

Answer:

It will print 20, because you are adding all the values of your list together using the max function, and then adding the actual integers in your list together with the previous number.

User Autodidacticon
by
2.9k points
17 votes
17 votes

Answer:

20

Step-by-step explanation:

max(my_list) is 5 (finds the maximum value)

sum(my_list) is 1 + 2 + 3 + 4 + 5 = 15 (finds the sum of values)

=> max(my_list) + sum(my_list) = 5 + 15 = 20

User Hokam
by
3.5k points