*** PHYTON 10级飞机任务 [英] ***PHYTON grade 10 airplane assignment

查看:73
本文介绍了*** PHYTON 10级飞机任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我明天有一个代码项目因为考试学习而无法做到。除了我的所有借口,我的老师要我做一个模拟飞机控制中心的代码。期望是输出插入的x,y,z坐标并且每秒减少它们直到距离为15并且告诉飞行员他/她是否具有足够的燃料着陆。如果不是,他/她必须紧急着陆。输出应该是例如。



例如:

你现在在__ x坐标

你是现在在__ y坐标

你现在在__ z坐标

你要__速度,总飞行时间是__

你是__远离着陆。 (距离)



代码必须非常基本,因为我只在10年级,我的老师只想要简单的代码。到目前为止我所做的只输出x,y,z。



请帮助我,非常感谢提前。





(这是我到目前为止)

#{Filename:< airplane control => }

#{程序:在着陆的20个距离处,它告诉飞行员是否有帮助/她

#是否有足够的燃料并输出坐标。}

#{大纲计划。检查您的飞机是否在20距离(如果不是这样)

#decreases by one并保持循环直到其20}

#{Programmer:< james cui = > }

#{Class:Class / Section(Mr.Sze)}

#{截止日期:< 1月28日,> }



随机导入

导入数学

导入时间



iend = 1

icounter = 0

iconsump = 50 #per hour

idestination =(0,0,0)

ix =输入(请输入你的x坐标)

iy =输入(请输入你的坐标)

iz =输入(请输入你的z coord)

ispeed =输入(请输入飞机的速度)

ifuel =输入(请输入你的燃料 )

idistance = math.sqrt((ix)^ 2 +(iy)^ 2 +(iz)^ 2)

itime = idistance / ispeed

iremain = itime * iconsump

iwind = random.randrange(1,50)



而iend> 0:

ixdeducted = random.randint(1,2)

if ix> 0:

如果ix == 1:

ix = ix - 1

else:

ix = ix - ixdeducted

else:

ix = ix + 0

print你现在在,ix,在X坐标上。

iydeducted = random.randint(1,2)

if iy> 0:

if iy == 1:

iy = iy - 1

else:

iy = iy - iydeducted

else:

iy = iy + 0

打印你现在在,嘿,在Y坐标上。

izdeducted = random.randint(1,2)

if iz> 0:

如果iz == 1:

iz = iz -1

else:

iz = iz - izdeducted

else:

iz = iz + 0

print你现在在,iz,在Z坐标上。

打印你总共飞行了,itime,小时





if idistance< ; = 15:

如果ifuel< iremain:xmlns:iremain =#unknown>

打印你没有足够的燃料,请紧急降落

iend == 0

否则:

打印你有足够的燃料降落,请继续

Hello i have a code project due tomorrow that i couldn''t do because of exam studying. Aside from all my excuses, my teacher wants me to do a code that simulates an airplane control center. The expectations are to output the inserted x,y,z coordinates and keep decreasing them by one every second until the the distance is 15 and tells the pilot whether or not he/she has enough fuel to land. If not he/she must make an emergency landing. the output should be for example.

e.g:
you are now at __ x coordinate
you are now at __ y coordinate
you are now at __ z coordinate
you are going at __ speed, Total flight time is __
you are __ away from landing. (distance)

the code has to be very basic as im only in grade 10 and my teacher wants only simple code. What i''ve done so far only outputs the x,y,z.

Please help me, many thanks in advance.


(this is what i have so far)
#{Filename: <airplane control=""> }
#{Program : At 20 distance of the landing it tells the pilot if help/she
#has enough fuel or not and outputs the coordinates.}
#{Outline program. checks if you plane is at 20 distance if it isnt it
#decreases by one and keeps looping until its 20}
#{Programmer : <james cui=""> }
#{Class : Class/Section (Mr.Sze) }
#{Due Date : <january,28,> }

import random
import math
import time

iend=1
icounter=0
iconsump=50 #per hour
idestination= (0,0,0)
ix= input ("please enter your x coord")
iy= input ("please enter your y coord")
iz= input ("please enter your z coord")
ispeed= input ("please enter the speed of your plane")
ifuel= input ("please enter your fuel")
idistance= math.sqrt((ix)^2+(iy)^2+(iz)^2)
itime= idistance/ispeed
iremain= itime*iconsump
iwind= random.randrange (1,50)

while iend > 0:
ixdeducted = random.randint(1,2)
if ix > 0:
if ix == 1:
ix = ix - 1
else:
ix = ix - ixdeducted
else:
ix = ix + 0
print "You are now at",ix,"on the X coordinate."
iydeducted = random.randint(1,2)
if iy > 0:
if iy == 1:
iy = iy - 1
else:
iy = iy - iydeducted
else:
iy = iy + 0
print "You are now at",iy,"on the Y coordinate."
izdeducted = random.randint(1,2)
if iz > 0:
if iz ==1:
iz = iz -1
else:
iz = iz - izdeducted
else:
iz = iz + 0
print "You are now at",iz,"on the Z coordinate."
print "You were flying for a total of",itime,"hours"


if idistance<=15:
if ifuel<iremain: xmlns:iremain="#unknown">
print "you do not have enough fuel,please make an emergency landing"
iend==0
else:
print "you have enough fuel to land, please proceed"

推荐答案

这不是一个问题。看起来你希望其他人为你做你的工作。此外,你想欺骗那些用你的双手做事的伙伴。



然而,他们不会成为输家,但你是。你有一个改变,以学习一些东西;好好利用这个机会。如果你自己动手,它只适合你。



对不起,你没有为你工作。我们正在帮助人民;你现在需要的最好的帮助是:开始工作。



-SA
This is not a question. It looks like you want other people to do your work for you. Besides, you want to cheat against your fellows who are doing things with your hands.

However, they are not going to be the losers, but you are. You are given a change to learn something; use this chance well. It will only work for you if you do it by yourself.

Sorry, you are not doing your work for you. We are helping people; and the best help you need right now is: get to work.

—SA


这篇关于*** PHYTON 10级飞机任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆