May 29, 2017 -- Python -- Append
append() --> appends/adds a passed object into an existing list
Syntax:
Have to have a preexisting list to have the new information added to it:
Example:
^ 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
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 : ", aListPrints:
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
Out[30]:
Comments
Post a Comment