Section 8.2 Use Library-WE1-P1
Subgoals for using libraries:.
-
Import module or function (if needed)
-
With alias (optional)
-
-
Determine whether parameters are appropriate for function
-
Number of parameters passed must match function documentation
-
Type of parameters passes must match function documentation
-
-
Determine what the function will return (i.e., data type), print, and/or change state of arguments and where it will be stored (nowhere, somewhere)
-
Evaluate expression as necessary
Subsection 8.2.1 Use Library-WE1-P1
Exercises Exercises
2.
3.
4.
Q4: Write a program that takes user input of an integer and prints half the absolute value of that integer.
5.
Q5: Enter the output of the following program or enter “invalid” if the statement would result in an error.
import math
print(math.fabs(-2.2))
You have attempted 1 of 5 activities on this page.