Which of the following statements is false?
a. Each function should perform a single, well-defined task.
b. The following code calls function square twice. We’ve replaced each of the output values with ???. The first call produces the int value 49 and the second call produces the int value 6:
In [1]: def square(number):
...: """Calculate the square of number."""
...: return number ** 2
...:
In [2]: square(7)
Out[2]: ???
In [3]: square(2.5)
Out[3]: ???
c. The statements defining a function are written only once, but may be called “to do their job” from many points in a program and as often as you like.
d. Calling square with a non-numeric argument like 'hello' causes a TypeError because the exponentiation operator (**) works only with numeric values.
b. The following code calls function square twice. We’ve replaced each of the output values with ???. The first call produces the int value 49 and the second call produces the int value 6:
In [1]: def square(number):
...: """Calculate the square of number."""
...: return number ** 2
...:
In [2]: square(7)
Out[2]: ???
In [3]: square(2.5)
Out[3]: ???
You might also like to view...
A function may return a pointer but the programmer must ensure that the pointer
a. still points to a valid object after the function ends b. has not been assigned an address c. was received as a parameter by the function d. has not previously been returned by another function e. None of these
A, B, C is an example of a(n) ____________________ alphabetic sort order.
Fill in the blank(s) with the appropriate word(s).
?
?
You plan to do some research on the types of web browsers your users will use. Referring to the figure above, this information fits in the ____ section of the project plan.
A. Site type B. Target Audience C. Timeline D. Client contact info
Hardware or software products that have been announced and promoted by vendors, but don't actually exist, are called ____________________.
Fill in the blank(s) with the appropriate word(s).