False otherwise value list expression 3 130923 in

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Python built ­in func9ons can be used on lists: minimum, maximum, and sum of elements • Finding the length (number of elements), same as for strings in Operator • VERY USEFUL Boolean expression for checking membership VALUE in LIST EXPRESSION True if the element is in the list. False, otherwise value list expression 3 13 ­09 ­23 in Operator •  The in operator can also be used with Strings •  We can also use not in to formulate Boolean expressions What is the output? even=[2,4,6] even.extend([0]) print(even) odd=[1,3,5] name=[“odd”] odd.extend(name) print(odd) What is the output? words=[“hello”,”Fred”,”bye”] if(words.pop()==“hello”): print(“x”) print(words) numbers=([1,3,5]+[7,9])*2 print(numbers) 4 13 ­09 ­23 Even more List Operators and Messages! • For a complete list of all List operators and messages, please refer to Appendix D of K.D. Lee, Python Programming Fundamentals. Accessing List Values • What if we have a list and we want to access every value i...
View Full Document

Ask a homework question - tutors are online