Changes

Jump to: navigation, search

OPS435 Python3 Lab 3

14 bytes removed, 21:46, 19 September 2019
PART 2 - Manipulating Items in Lists
print(courses)
</source>
:#Below are some examples of using built-in methods (they are functions that are associated with to list object, you use the dot notation with the name of the list as the prefix when call calling those methods on the list object) to '''manipulate''' list objects. Take your time to see how each method can be a useful tool for making changes to existing lists:<source lang="python">
courses.append('ops235') # Add a new item to the end of the list object named courses
print(courses)
</source>
:#In addition to using built-in methods to manipulate lists, there are functions that are useful to provide '''information''' regarding the list such as the number of elements items in a list, the smallest value and largest value in a list:<source lang="python">
list_of_numbers = [ 1, 5, 2, 6, 8, 5, 10, 2 ]
length_of_list = len(list_of_numbers) # Returns the length of the list
1,760
edits

Navigation menu