CMPUT174 Study Guide - Midterm Guide: Empty String, Sorting Algorithm, Tuple

264 views2 pages
ceruleanzebra152 and 30 others unlocked
CMPUT174 Full Course Notes
25
CMPUT174 Full Course Notes
Verified Note
25 documents

Document Summary

Division = //, gives oat value not decimal if you use whole numbers (ie 15//7=2 15. 0//7=2. 0) x/y will give decimal value! x%y gives remainder of dividing the two! | list(iterable) -> new list initialized from iterable"s items! | l. count(value) -> integer -- return number of occurrences of value! | l. extend(iterable) -- extend list by appending elements from the iterable! | l. index(value, [start, [stop]]) -> integer -- return rst index of value. | l. insert(index, object) -- insert object before index! | l. pop([index]) -> item -- remove and return item at index (default last). | raises indexerror if list is empty or index is out of range. | l. remove(value) -- remove rst occurrence of value. | raises valueerror if the value is not present. | l. sort(key=none, reverse=false) -- stable sort *in place*! class tuple(object)! | tuple(iterable) -> tuple initialized from iterable"s items! | if the argument is a tuple, the return value is the same object.