Question: how types affect execution, part 3 = 0 Here is the same program one more time, again with different starting values for the data list.

 how types affect execution, part 3 = 0 Here is the
same program one more time, again with different starting values for the

how types affect execution, part 3 = 0 Here is the same program one more time, again with different starting values for the data list. # assume Python 2 data = [ "1", "2", "3" ] total = 0 average n = 0 for value in data: n += 1 total += value average total print "average:", average Now what averages are printed? 1, 1.5, 2 "1","1.5", "2" 1,6,41 error before the program starts error while the program is running snapshot diagrams and final Suppose we want to add final to both variable declarations in the hailstoneSequence method, as shown: public static List haiistone Sequence(final int n) list = new ArrayList(); while (n = 1) { list.add(n); if (n%2 == 0){ n = n/2; } else { n- 3* n + 1; > } list.add(n); return list; } Which of the following are true statements about putting final on n? final can't be used on n because n is a parameter of a method final can't be used on n because its type is int and int is already immutable final can't be used on n because n is reassigned to other integer values in the body of the method final can be used on n, and it prevents n from being reassigned Which of the following are true statements about putting final on list ? final can't be used on list because list is a local variable final can't be used on list because its type is List and List is a mutable type final can't be used on list because list.add() is used to change the list in the body of the method final can be used on list, and it prevents the list variable from being reassigned

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!