簡體   English   中英

python中While循環的語法錯誤

[英]Syntax error on While loop in python

我在第一個while循環中收到語法錯誤,特別是在“ Y”處

#Calculates trajectory under various angles
from math import*
from Density import*
from Fdrag import*
from pylab import title, xlabel, ylabel, show, plot, legend

#constants
rho0=1.2            #standard density of air at ground (kg/m^3)
g=9.81              #acceleration due to gravity (m/s/s)
T0=288.15           #ground temperature
D=0.1               #diameter (m)
A=pi*D^2/4          #Area
m=4                 #mass (kg)

for theta in (25, 50, 75):  #range of trajectories
    #initial conditions
    V=2800                  #velocity m/s
    Vx=V*cos(theta)         #horizontal velocity component
    Vy=V*sin(theta)         #vertical velocity component
    t=0                     #time
    dt=0.01                #time step (s)
    X=0                     #position
    Y=0.0                     #position
    x=[0]                    #position list (x component)
    y=[0]                    #position list (y component)
    vx=[Vx]                   #velocity list (x component)
    vy=[Vy]                   #velocity list (y component)
    T=[]                    #time list
    peaked=0                #use peakes as flag

    While Y>=0:
Then the rest of my code

While必須用小寫的“ w”編寫,否則Python不會識別它/

While應該是小寫字母( while

腳本末尾的While Y>=0:行中的While應該為while (小寫的“ w”)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM