- 1

AttributeError: 'tuple' object has no attribute 'append'

age(23,43,25,53,22) age.append(100) print(age) I tried to run the above code on JetBeans but error occurred. AttributeError: 'tuple' object has no attribute 'append' please help.

5th Jul 2017, 5:19 PM
Harendra Bhujel
Harendra Bhujel - avatar
4 Réponses
+ 1
Try this: age=[23,43,25,53,22] age.append(100) print(age)
5th Jul 2017, 5:25 PM
Ghauth Christians
Ghauth Christians - avatar
+ 1
Hey, Thanks a lot... It worked...
5th Jul 2017, 5:34 PM
Harendra Bhujel
Harendra Bhujel - avatar
+ 1
:)
5th Jul 2017, 5:34 PM
Harendra Bhujel
Harendra Bhujel - avatar
0
You need to use this [] instead of () when u make a list,that is the problem i ran to when using python,and that was the solution.try it.
20th Sep 2021, 9:10 AM
Oliver