当我运行Python代码时,我的Python就关闭了
当我打开包含此代码的.py文件时,它会显示一秒钟,然后消失。如何修复此问题,以便查看输出当我运行Python代码时,我的Python就关闭了,python,Python,当我打开包含此代码的.py文件时,它会显示一秒钟,然后消失。如何修复此问题,以便查看输出 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,
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"
我想你正在使用Windows。如果要查看输出,我建议您在包含要执行的Python脚本的目录中打开一个命令提示符,然后尝试运行
Python.py
如果在文件资源管理器中打开了该目录(如果双击该文件,我想您会这样做),快速快捷方式是在文件资源管理器中按住Shift键并单击鼠标右键,然后选择“在此处打开命令窗口”以打开该目录中的提示。open cmd:
开始->cmd(在“搜索程序和文件”中)并在此运行脚本。“Python刚刚关闭”-您正在使用windows吗?然后双击windows资源管理器中的文件?如果是,则您必须学习如何使用命令行,或者在程序结束时添加暂停执行的内容(例如:
input()
)也请(学习)正确格式化您的代码,在创建问题时,有一些选项可以自动执行大部分操作。因此,如果您想在此处粘贴代码,请使用“输入代码”按钮。现在无法读取。