Итак, я новичок в Python.Невозможно исправить эту досадную ошибку! : L
Мы начали освещать его в школе, и у меня возникли некоторые проблемы.
Я пытаюсь создать викторину в python с системой очков. Система точек работает в течение первых двух вопросов, но когда дело доходит до третьего вопроса я всегда получаю следующее сообщение об ошибке:
Traceback (most recent call last):
File "C:\Python33\ICT kat.py", line 63, in <module>
print(" You have " + str(score) + " points so far!")
TypeError: 'str' object is not callable
Ниже является кодированием, где появляются ошибки, которые будут приходить от:
print("Question 3:")# This the third question in the quiz
print(my_name + ", What is the total amount of days in February + March + June in a leap year.")
qu3_ans = input()# This is where the user would input their answer
if qu3_ans == "90":# This is the answer to the question
print("Good job! + 1 point")#If the user gives the correct answer this is displayed
score = score + 1 #This is the points system
else:
print("That was the wrong answer! :(")#If the user gets anything other than 90 this will be displayed
print("No point for you! ^_^")# " "
print=(" ") #Used like the enter key in a word processing progra,
print(" You have " + str(score) + " points so far!")#This is where the errors occurs, and is used to displayed the current amount of points
Похоже, вы использовали 'str' как имя переменной в другом месте кода. – Aya
Вы можете изменить свой последний оператор 'print' на следующую« печать »(« у вас есть », оценка,« точки до сих пор! »), Которые исправят ее. – Sam
Также (поскольку это Python) убедитесь, что вы правильно отпечатали свой код. – iamnotmaynard