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>There are quite a few issues with your code</p>

<p>First of all, you have not closed your parenthesis on lines 4 and 5</p>

<p>Secondly, you're trying to call variables by strings. That isn't how it works</p>

<pre><code>QV = (float("FRT"*"UI"))
</code></pre>

<p>should be</p>

<pre><code>QV = (float(FRI * UI))
</code></pre>

<p>Lastly, <code>input</code> already displays text, so you don't need to <code>print</code> anything, and since <code>print</code> returns <code>None</code>, UI will always be <code>None</code>. </p>

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

<p>should be</p>

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

<p>So, the complete debugged code should be:</p>

<pre><code>#This is where I ask the user for input for a value 
UI = 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>

python math input floating-point integer