The answer is option C (float(x)). float(x) method converts x to a floating-point number.
#Convert string to float
x = '1234'
x1 = float(x)
type(x1) #check the datatype after conversion
Output:
Float
You can check out this Python Functions to learn more about data type conversions with examples.
Also, watch this video on Python Functions:
If you are interested to learn Python from Industry experts, you can sign up for this Python Certification Course by Intellipaat.