Functions
Built-in Functions
Use the built-in functions abs()
, round()
, pow()
, int()
, float()
, and
str()
to print out the answers to the following. A built-in function is one
that you don’t need to import a module to use. Use another function, help()
,
to learn how to use any of the functions that you don’t know how to use
appropriately. help()
takes one parameter, the name of the function you want
information about. E.g.,help(pow)
.
- The absolute value of -15.5.
- 3.8 rounded to the nearest integer using standard rounding.
- 4.483847 rounded to one decimal place.
- Convert 3.8 to an integer format using int(), assign the value to a
variable, and print out it’s value.
- Convert the answer to the previous question to a string and assign it
back to the same variable name, print out the value.
- Convert the answer to the previous question to a float and assign it
back to the same variable name, print out the value.
- Take the square of the answer to the previous question, assign it the
same variable name, print out the value.
[click here for output]