May 29, 2017 -- Python -- Append

append() -->  appends/adds a passed object into an existing list

Syntax:
list.append(obj)

Have to have a preexisting list to have the new information added to it:
Example:
aList = [123, 'xyz', 'zara', 'abc'];
aList.append( 2009 );
print "Updated List : ", aList
Prints:
Updated List :  [123, 'xyz', 'zara', 'abc', 2009]

^ demonstrating how the new information of "2009" was added to the end of the preexisting list



In the case of the information with the USP data, it will append information on student survey results to preexisting file including grade, school, gender, and sessions taken while at USP.

When successfully completed, the code will properly match a student's survey results to their previously mentioned data by recognizing the same name and appending the survey responses to the end of the original information.

Previously made list of student names:    Self.Students
Previously made list of survey questions:   Self.Questions





a=[5,6,6,1,3]
print a.count(6), a.count(5)
a.insert(2,-1)
a.append(6)
a
2 1
Out[30]:
[5, 6, -1, 6, 1, 3, 6]

Comments

Popular posts from this blog

6/14/17 Notes

6/06/17 Notes (formatting code and searching for a specific person)

May 22, 2017 -- SienaSemanticsSurvey -- Code Breakdown -- Cell #8