CISC 121 Lecture Notes - Lecture 3: Associative Array, Bracket

95 views3 pages
Verified Note

Document Summary

To determine the number of elements in a list, use same len() function used with strings len([ a", 7, 8. 2, fred"]) == 4 # is true. Regarding the len() function, it returns a count of the items in a list, but indexes don"t go that high (as they"re 0-based). my_list = [2, 44, 0, hello", 7] When declaring, initializing or adding elements to a list, you can use literals/variables. As each list element is a variable in itself, its value is changeable (i. e. with an assignment). To distinguish methods from functions in these notes, we will make an effort to write methods with a preceding period. Method: specialized function specific to a particular data type (unlike len() function, which can be used on strings and lists). It is evident when a method is being used instead of a function, as it"s invoked in a specific way. You can also use the internet to help determine which you are dealing with.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents