Q:

'int' object has no attribute called 'append'

while printing score its showing error
question1 = input("what is the capital of india ")
answer1 = "delhi"
print("")
question2 = input("what is the capital of telangana ")
answer2 = "hyderabad"
print("")
question3 = input("what is the capital of andhra pradesh ")
answer3 = "amaraavathi"
print("")
score = len([])
if question1 == answer1 :
        print("correct answer")
        print('')
else :
        print('wrong answer')
        print('')
if question2 == answer2 : 
        print("correct answer")
        print('')
else :
        print("wrong answer")
        print('')
if question3 == answer3 :
        print("correct answer")
        print('')
else :
        print("wrong answer")
        print('')
if question1 == answer1 :
        score.append(3)
else :
        score
if question2 == answer2 :
        score.append(2)
else :
        score
if question3 == answer3 :
        score.append(3)
else :
        score
print(score)

A:

The line score = len([]) uses the len function, which returns the INTEGER (int) length of the list specified. In python, integers cannot be appended to, like you are trying to do when you try to append the score at the end. Perhaps what you were intending to do was add to the score, for which the syntax is score = score + 1 and the shorthand version is score += 1

