My program prompts the user to input the volume of a sphere. This is one of the example input I have to try:
- 1.4*1.0e6
This is what I have as the prompt right now: volume = float(input("Enter volume of sphere in mm^3: "))
And I got this error: ValueError: could not convert string to float: '1.4*1.0e6'
Why is it that when I directly assign the value of a variable like a = 1.4*1.0e6
, it's a float but when the user inputs, it's a string? How do I convert it to float? Is there any built-in functions to do that?
Sorry for my bad English and thank you.