2016-12-21 28 views
0

当我打开我的.py文件与此代码中,它显示了一个简短的第二次,然后消失。我如何解决这个问题,以便我可以看到输出结果?运行我的Python代码我的Python只是关闭

print "Hello welcome to Mcdonald's how may I help you" 
print "Type 1 for food" 
print "Type 2 for drinks" 
user_input = input ("Type 3 for money") 
if (user_input) == 1: 
    print "We have Hamburgers, fries, and cancer" 
    print "Type 1 for hamburgers" 
    print "Type 2 for fries" 
    user_input = input ("Type 3 cancer") 
    if (user_input) == 1: 
     print "That will cost you $1.25" 
     print "Type 1 to pay" 
     user_input = input ("Type 2 to steal") 
     if (user_input) == 1: 
      user_input = input ("Thank you for comming") 
     elif (user_input) == 2: 
      user_input = input ("HEY COME BACK AND PAY!") 
    elif (user_input) == 2: 
     user_input = input ("Potato!") 
    elif (user_input) == 3: 
     user_input = input ("Sorry we are out of cancer") 
if (user_input) == 2: 
    print "We have Coke, and Pepsi" 
    print "Type 1 for Coke" 
    user_input = input ("Type 2 for Pepsi") 
    if (user_input) == 1: 
     user_input = input ("COKE SUCKS NO DRINKS FOR YOU!!!!!") 
    elif (user_input) == 2: 
     print "Nice I LOVE Pepsi Coke sucks that will cost you $1.00" 
     print "Type 1 to pay" 
     user_input = input ("Type 2 to steal") 
     if (user_input) == 2: 
      user_input = input ("HEY COME BACK AND PAY!") 
if (user_input) == 3: 
    print "So heres the plan you take the register ill destract the others." 
    print "Type 1 To call the cops" 
    user_input = input ("Type 2 to do the plan") 
    if (user_input) == 1: 
     user_input = input ("You got $150 for calling the cops") 
    elif (user_input) == 2: 
     user_input = input ("You got $150 for doing the plan") 
else: 
    print "Sorry I did not get your order" 
+1

*“巨蟒只是关闭” * - 您是否使用的窗口?并在Windows资源管理器中双击该文件?如果是的话,那么你将不得不学习如何使用命令行或添加什么东西在你的程序结束时暂停执行(例如:一个'输入()') – UnholySheep

+1

也请(学会)正确地格式化你的代码,有创建 – UnholySheep

+0

此外,如果你想在这里粘贴代码的问题时做的大部分是自动选择,请用“输入代码”按钮做到这一点。现在它是不可读的。 – Moberg

回答

0

我假设你使用的是Windows。如果你想看到的输出,我建议你在包含要执行,然后尝试运行python <your script>.py的Python脚本的目录中打开一个命令提示符。

如果你有一个文件浏览器打开的目录(我猜你做,如果你双击该文件),一个快捷键是 +文件资源管理器中单击鼠标右键,选择“在此打开命令窗口“以打开该目录中的提示。

-1

打开CMD: 开始 - > CMD(在“搜索程序和文件”),并运行在这个脚本。