0

Python で非常に単純な加算計算機を作成しました。

#This program will add two numbers entered in by the user

print "Welcome!"

num1 = input("Please enter in the first number to be added.")
num2 = input("Please enter in the second number to be added.")

sum = num1 + num2

print "The sum of the two numbers entered is: ", sum

まだ python をセットアップしていないので、codepad.org (オンライン コンパイラ) を使用しています。

次のエラーが表示されます。

Welcome!
Please enter in the first number to be added.

Traceback (most recent call last):
Line 5, in <module>
  num1 = input("Please enter in the first number to be addeded.")
EOFError
4

3 に答える 3

7

問題は、コードパッドがコードを実行している間、対話性を提供しないことです(プログラムは入力を求めるプロンプトが表示されたときに失敗し、コードパッドは入力を提供できないため、エラーが発生します)。エラーの詳細については、https://web.archive.org/web/20120104164315/http://pyref.infogami.com/EOFErrorを参照してください。

あなたは本当に先に進んでPythonをインストールし、ローカルマシンからそれを操作する必要があります。http://www.python.org/download/

ああ、そしてPythonを学んで頑張ってください!

于 2011-01-12T05:18:23.477 に答える
3

特別な入力フレームがある場合はideoneを使用してください。はい、まだ対話性はありませんが、便利な標準入力です。そこに数字を入力するだけです。

于 2011-01-12T05:47:15.890 に答える