How to multiply user input by a decimal number in python?
<p>Hello I am having trouble with using strings and integers during multiplication. If there is something I do not think I have done anything fundamentally wrong but then again, it's not working so I probably have done! </p>

<p>This is my code as of now.</p>

<pre><code>    #This is where I ask the user for input for a value 
UI = print (float(input("Enter your value here: ")))
#Here I have numbers that I need to multiply the input by
FRT = (float(0.290949)
SRM = (float(0.281913)
#Here is the multiplication but this is where the issue occurrs
QV = (float("FRT"*"UI"))
SV = (float("SRM"*"UI"))
</code></pre>

<p>Both of these lines at the end have issues, I have tried using different set ups with using the numbers instead of defining them as FRT and SRM and using integer before float etc, but with these lines they both give the error "could not convert string to float "FRT""</p>

<p>"FRT" is a string, made of the letters F, R &amp; T. If you want to refer to the variable FRT, do not use quotation marks. <code>QV = (float("FRT"*"UI"))</code> is trying to first multiply the string "FRT" by the string "UI", and then convert the result to a float. Since string multiplication is not defined, you get an error.</p>

<p>In your current code, I am unsure of what UI is, since you did not make it equal to a number but to the result of a <code>print()</code>. Your first line should be replaced by</p>

<pre><code>UI = float(input("Enter your value here: "))
print(UI)
</code></pre>

<p>Then, <code>QV = FRT * UI</code> will do what you want, since both FRT and UI are floats. The parentheses around each operation are not needed.</p>

python math input floating-point integer