Question # 3

Dropdown
What type of data is the result of each of the following lines of code?
str(2.34)

int('2')

float(2)

1 answer

Here's the type of data produced by each line of code:

  1. str(2.34) - This converts the number 2.34 into a string. The result is of type string.

  2. int('2') - This converts the string '2' into an integer. The result is of type integer.

  3. float(2) - This converts the integer 2 into a floating-point number. The result is of type float.