0
I need to input this function and this value to make the calculation but this conversion error
#1ª tentativa
x0 = float(input('valor: '))
fx = float(input('função')) #Exemplo: (x0**4)^2-9*x0
print(fx)
#2ª
x0 = float(input('valor: '))
fx =(input('função') #Exemplo: (x0**4)^2-9*x0
print(float(fx))
Valueerror: could not Convert string to float
Hello, from what I could see the code is correct for what you described you want to do, it gets a type 3.3 input and converts to float. Which entrance are you passing?
– Danilo Costa
@Danilocosta for the variable x0 I will give example input:
2.5
and for the variable fx I will put an example function(x0**4)-9
– WSS
Not by, you can not put the function so no, it will interpret as a string even. What you can do is put this expression '(x04)-9' in a def, and then you call def. It would be something like this: def calculate (x0): Return (x04)-9 x0 = float(input('value: ')) print(float(calculate(x0)))
– Danilo Costa
Check out the @Andersoncarloswoss comment
– Danilo Costa