Applications Closing for Certification Course on Artificial Intelligence and Deep Learning by IIT Roorkee | Closing in

  Apply Now

Type Conversion Functions

We can also use certain built-in functions to convert one data type to another. For eg,

  • int - It takes any value and converts it to an integer, if it can, or returns the error.


    It returns 23. Try converting the string "cloudxlab" to int and see the result.

  • float - It converts integers and strings to floating-point numbers.


    It returns 2.0

  • str - It converts its argument to a string


    It returns '123'

  • Calculate the area of a square whose length of one edge is 8.9 and store it in the variable square_area
  • Store the type of square_area in square_area_type
  • Convert the square_area into int and store it in square_area_int
  • Convert the square_area_int into str and store it in square_area_str

You can use the print function to see the values of your variables.

No hints are availble for this assesment

Answer is not availble for this assesment

Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...