2017-03-16 20 views
-2

私はインターネットなどで多くのことを探していましたが、回答を見つけることができませんTypeError: 'str'オブジェクトは呼び出し可能ではありませんバグ私は彼らのスコアを合計し、その後答えるようにユーザーのための質問をすることを意図している私のプログラムを実行しようとするたびに、私はTypeError: 'str'オブジェクトは呼び出し可能ではない問題

input = ("What is your name?") 
print = ("I will ask you 10 questions and give you three choices for each question \n IMPORTANT! PLEASE KEEP YOUR CAPSLOCK ON") 

score = 0 
score = int(score) 

q1 = input("What piece of code would show a word/sentence and nothing else \n A. print() \n B. input() \n C. int(print) ") 

if q1 == ("A") : 
    print ("Well done! That is correct") 
    score = score + 1 
    print ("Your score is",score,) 
elif q1 == ("B") : 
    print ("That is incorrect") 
elif q1 == ("C") : 
    print ("That is incorrect") 

を継続したい場合は、この問題を解決する必要がある、おかげで私を助けてください!

+6

'print'関数を文字列で上書きしました。別の変数名を使用する –

+1

@ Farhan.K OPはその名前に全く代入するつもりはないと思われます。実際には 'print()'を呼び出すことを意図していました。 –

+1

@DanielRosemanええ、おそらくそうです。 @Pegafernoこの場合、 'print'の後に' = 'を取り除きたいでしょう –

答えて

5
input = ("What is your name?") 
print = ("I will ask you 10 questions and give you three choices for each question \n IMPORTANT! PLEASE KEEP YOUR CAPSLOCK ON") 

文字列で、inputprint機能を上書きします。 use

name = input("What is your name?") # the input will be stored in name 
print("""I will ask you 10 questions and give you three choices for each question. 
IMPORTANT! PLEASE KEEP YOUR CAPSLOCK ON.""") 
関連する問題