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).

  1. The absolute value of -15.5.
  2. 3.8 rounded to the nearest integer using standard rounding.
  3. 4.483847 rounded to one decimal place.
  4. Convert 3.8 to an integer format using int(), assign the value to a variable, and print out it’s value.
  5. Convert the answer to the previous question to a string and assign it back to the same variable name, print out the value.
  6. Convert the answer to the previous question to a float and assign it back to the same variable name, print out the value.
  7. Take the square of the answer to the previous question, assign it the same variable name, print out the value.
[click here for output]