在内部关闭python?

时间:2016-10-20 16:28:48

标签: python

我做了GCSE计算,所以我对python有了不错的理解,我现在做的A级是物理学的A级。我和我的朋友正在构建一个符合许多较小代码的代码,这些代码都为我们找出方程式。我正在构建代码的框架,我想知道是否有一个代码完全关闭python而不仅仅是我当前正在运行的代码?我环顾四周,但却找不到一个可以做到的。

先谢谢。

修改

这是我的代码;

import sys
print ("Welcome to Adam and Emrys' master code for figguring out all of your physic equations")

masterloop = 1
while masterloop == 1:
masterloop == 0

typeq = input("Now out of; waves, photoeletric effect    , which are you dealing with? ")

if typeq == "wave" or typeq == "waves" or typeq == "Wave" or typeq == "Waves":
    h=6.63*10**-34
    c=3*10**8
    loop=1
    print("(HC)/E=lambda and (HC)/lambda=E")
    while loop==1:
        loop=0
        Achoice=input("Are you working out the wave length or the energy?:")


        if Achoice=="energy"or Achoice=="Energy"or Achoice=="E":
            lambdA=float(input("What is the wavelength in meters?:"))
            e=(h*c)/lambdA
            print("HC over Lambda where the wavelength is",lambdA,"gives an energy of",e,"joules.")
        elif Achoice=="Wavelength"or Achoice=="wavelength"or Achoice=="W":
            e=float(input("What is the energy in joules?:"))
            lambdA=(h*c)/e
            print("HC over E where E is",e,"Gives wavelength as",lambdA)
        else:
            print("This is not an acceptable answer, please try again.")
            loop=1

elif typeq == "photoeletric effect" or typeq == "Photoeletric effect":
    h = 6.63*10**-34
    c = 3*10*8
    loop = 1
    print ("hf = Thi + Ekmax so Ekmax = hf - Thi, Thi being the Work function")

    while loop == 1:
        loop = 0
        freq = float(input("What is the frequancey of the light? "))
        Thi = float(input("What is the work funcion for your metal? ")
        answer = (( h * freq ) - Thi)

else:
    print("Thats not an exepted answer sorry please try again")

repet = input("Do you want to as another question or do you want to end the program? ")
loop = 1

while loop == 1:
    if repet == "another" or repet == "Another":
        loop = 0
        masterloop = 1

    elif repet == "end" or repet == "End":
        loop = 0
        sys.exit()

对不起大家浪费你的时间我没有意识到sys.exit()并没有在shell中结束它我很抱歉谢谢你澄清。

0 个答案:

没有答案
相关问题