2016-12-21 7 views
0

このコードを含む.pyファイルを開くと、すぐに2秒間消えて表示されます。これを修正して出力を確認できますか?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

* "Pythonが閉じます" * - あなたはウィンドウを使用していますか? Windowsエクスプローラでファイルをダブルクリックしますか?もしそうなら、あなたはプログラムの最後で実行を一時停止するためにコマンドラインを使う方法を追加するか(例えば 'input()') – UnholySheep

+1

あなたのコードを適切に書式化してください質問を作成するときにほとんどのオプションを自動的に行うオプション – UnholySheep

+0

また、ここにコードを貼り付ける場合は、「コード入力」ボタンを使用してください。今は読めません。 – Moberg

答えて

0

あなたはWindowsを使用していると仮定します。出力を確認したい場合は、実行するPythonスクリプトを含むディレクトリにコマンドプロンプトを開き、python <your script>.pyを実行してみることをお勧めします。

ファイルエクスプローラでディレクトリを開いている場合(ファイルをダブルクリックすると思います)、へのショートカットはShift +ファイルエクスプローラ内で右クリックして[ここでコマンドウィンドウを開く "を選択すると、そのディレクトリのプロンプトが開きます。

-1

cmdを開きます: スタート→cmd(「プログラムとファイルの検索」)で、このスクリプトを実行します。

関連する問題