Reputation: 11
def datos_velocidad_turbohelice(incremento):
velocidadInicial = 181.3566
aceleraciónInicial = 3 - 0.000062 *(velocidadInicial**2)
print('Tiempo '+ 'Velocidad(m/s) '+ 'Aceleracion(m/s**2) '+'\n')
print ('0 '+ str(velocidadInicial) + str(aceleraciónInicial))
tiempo=incremento
while tiempo <= 130:
velocidadIncremento= (0.00001(tiempo**3)) - (0.00488(tiempo**2)) + (0.75795(tiempo)) + 181.3566
aceleracionIncremento= 3 - (0.000062 *(velocidadIncremento**2)
print (str(tiempo)+str(velocidadIncremento)+str(aceleracionIncremento))
tiempo+= incremento
datos_velocidad_turbohelice(20)
my question is where is the error? it says
print (str(tiempo)+str(velocidadIncremento)+str(aceleracionIncremento))
^
SyntaxError: invalid syntax
Upvotes: 1
Views: 110
Reputation: 3570
You have several syntax error in line number 8
and 9
. You need to add *
before the brackets and in line number 9
you added an extra bracket which you did not close.
velocidadIncremento= (0.00001*(tiempo**3)) - (0.00488*(tiempo**2)) + (0.75795*(tiempo)) + 181.3566
aceleracionIncremento= 3 - 0.000062 *(velocidadIncremento**2)
Upvotes: 0
Reputation: 1162
You have a few errors here.
For one, the SyntaxError you are initially describing impacting this line, (str(tiempo)+str(velocidadIncremento)+str(aceleracionIncremento))
is not actually involving this line but rather the line above it, aceleracionIncremento= 3 - (0.000062 *(velocidadIncremento**2)
; you are missing a closing parenthesis there at the end.
Once you fix this error you will encounter another error (a TypeError) stating that the 'float' object is not callable
, to which you will need to address by fixing this line velocidadIncremento=(0.00001*(tiempo**3)) - (0.00488*(tiempo**2)) + (0.75795*(tiempo)) + 181.3566
by adding an *
operator to multiply the 0.75795
by tiempo
. This should fix the code.
Full fix below.
#!/usr/bin/env python3
def datos_velocidad_turbohelice(incremento):
velocidadInicial = 181.3566
aceleracionInicial = 3 - 0.000062 *(velocidadInicial**2)
print('Tiempo '+ 'Velocidad(m/s) '+ 'Aceleracion(m/s**2) '+'\n')
print('0 '+ str(velocidadInicial) + str(aceleracionInicial))
tiempo=incremento
while tiempo <= 130:
velocidadIncremento=(0.00001*(tiempo**3)) - (0.00488*(tiempo**2)) + (0.75795*(tiempo)) + 181.3566
aceleracionIncremento= 3 - (0.000062 *(velocidadIncremento**2))
print(str(tiempo)+str(velocidadIncremento)+str(aceleracionIncremento))
tiempo+= incremento
datos_velocidad_turbohelice(20)
Output:
Tiempo Velocidad(m/s) Aceleracion(m/s**2)
0 181.35660.960806585459
20194.64360.6510598767
40204.50660.406977134499
60211.42560.228551371208
80215.88060.110525125706
100218.35160.0439998842013
120219.31860.0177598050305
Upvotes: 1