I'm new to python, and have just recently started using it as a means to circumvent my lack of calculus knowledge when performing physics equations. The problem I'm working on now is fairly simple, but I'm getting a bizarre syntax error I don't understand.
Here's my code:

## Introduction ##

print "Welcome to python syringe velocity calculator!"
print "Please enter the following units in centimeters for distance,"
print "kilos for mass, and seconds for time."

## inputs ##

r= input("Internal radius of syringe:")
Lo= input("Distance from plunger to cap before expansion:")
L = input("Distance of plunger to cap after expansion:")
M = input("Mass of plunger:")
R= input("Number of recalculations(higher for more accurate values):")

## Entering equations in the correct order ##

Px= 10.1
pie= 3.1415926
Ar= pie*(r*r)
Vo= Lo*Ar
Vi= Ar*L
Pi= Px*(Vo/Vi)

F= Ar*Pi-Ar*Px
A= F/M
V= 0.0

print "Calculating..."

while t <= input("Duration of calculation:"):
    L = L-((V*(t/R))+(A*((t/R)*(t/R))/2.0)
    V = V+A*(t/R)
print "Calculations complete"
print "time elapsed:", t, "second(s)"
print "position of plunger (from cap):", L, "centimeter(s)"
print "velocity of plunger:", V, "centimeters/second"
Print "internal pressure:", Pi, "newtons/centimeter^2"

While I'm sure there are numerous errors (all of which I would greatly appreciate help working out) I'm most recently stuck on a mysterious syntax error on line 32:

V = V+A*(t/R)

Looks fine to me. Can anyone tell what the problem is?

7 Years
Discussion Span
Last Post by jlm699

A closing parenthesis is missing on the previous line. Also the last line has Print instead of print. There are other errors.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.