Reputation: 21
import sympy
import math
from sympy import *
a, b, c, d, stf, lc = symbols('a b c d stf lc')
init_printing()
cxy = float(input("parametr Cxy ")) #
print(cxy)
cz = float(input("parametr Cz ")) #
print(cz)
m = float(input("masa ładunku ")) #
print(m)
u = float(input("parametr u tarcie "))
print(u)
g = 9,80665
print(g)
frc = ((cxy - u * cz) * m * g)
frc.evalf(6)
print (frc)
print ("kompensacja", frc, "daN")
here's the code, and constantly on anaconda i'm getting:
TypeError Traceback (most recent call last)
<ipython-input-28-a7c280fc56b4> in <module>()
21 print(g)
22
---> 23 frc = ((cxy - u * cz) * m * g)
24 frc.evalf(6)
25 print (frc)
TypeError: can't multiply sequence by non-int of type 'float'
input is a float and there's still an error. I'm running it on Anaconda 3, but it shouldn't be a problem to do simple multiplying.
Upvotes: 1
Views: 59
Reputation: 81664
The problem is that g
is a tuple: g = 9,80665
You probably meant to do g = 9.80665
It is possible to multiply an integer and a tuple (although the output will not be what you probably expect it to be), but it's impossible to multiply a float and a tuple.
Upvotes: 1