[Tutor] TypeError: object doesn't support item assignment [ Trying to learn how to enter value in array ]
John Joseph
jjk_saji at yahoo.com
Mon Jan 2 09:48:42 CET 2006
Hi All
I am trying to write a program in which I enter
the no of students and then for the students I enter
the marks and later on Display the marks
The script which I wrote is given below , when I run
the program I get error
TypeError: object doesn't support item assignment ,
my aim in doing this program is to learn how to enter
values in a array , please advice how can I avoid
this error
Guidance requested
Thanks
Joseph
##################################################################
# This program is to learn how u enter entry to the
array
# And how u print it ,
print " \nFirst Enter the No of Students ... "
print "\n Then No of marks "
# defining empty array a
a = ()
# defining i
i = 0
# n is the No of students which I have to enter the
marks
n = int(raw_input("Enter the no: of students : \n"))
# m is the Marks of the students which I have to enter
while i < n:
m = int(raw_input("Enter the Marks for the
students : \n"))
a[i] = m
print "Marks are ", m
i = i+1
#print "Array Marks ", a[i]
___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
More information about the Tutor
mailing list