Question: documenting assumptions, part 2 if you were writing Java instead of Python, and your Java code needed to make all the assumptions below, then which



documenting assumptions, part 2 if you were writing Java instead of Python, and your Java code needed to make all the assumptions below, then which of them could be documented by type declarations and statically checked by the Java compiler? person must be an object with age and name instance variables person is not null person, age must be a nonnegative number personage must be an integer person. nane must be a string how types affect execution = # assume Python 2 data = [ 2, 4, 6] total = average = 0 n = for value in data: n += 1 total += value average = total print "average:", average What averages are printed? O 1,1,1 1, 2, 3 2, 3, 4 O2,4,6 error before the program starts error while the program is running documenting assumptions Consider the following simple Python function: from math import sart def funFactAbout (person): if sqrt(person.age) person.age: print("The age of " + person.name + " is a perfect square: " + str(person age)) Which of the following are assumptions made by this code, which must be true in order for it to run without errors? person must be an object with age and name instance variables person is not None person, age must be a nonnegative number person.age must be an integer person.name must be a string kinds of error checking, part 5 7; double sum = double n = ; @ double average = sum; static error dynamic error no error, wrong
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
