TypeError:' str'对象不是可调用的问题

时间:2017-03-16 13:32:59

标签: python

我之前一直在浏览互联网以及之前的其他人,无法找到我继续得到 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")

请帮帮我,谢谢!

1 个答案:

答案 0 :(得分: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函数。使用

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.""")