#NoPayJan Offer - Access all CloudxLab Courses for free between 1st to 31st Jan

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

    int(23.45)
    

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

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

    float(2)
    

    It returns 2.0

  • str - It converts its argument to a string

    str(123)
    

    It returns '123'

INSTRUCTIONS
  • 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...