所以,我是 Python 的新手。
我们已经开始在学校报道它,我遇到了一些问题。
我正在尝试使用积分系统在 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