Computer Science 1026A/B Chapter Notes - Chapter 6: John Q., Concatenation, Substring

71 views13 pages
terubarenuka and 39895 others unlocked
COMPSCI 1026A/B Full Course Notes
26
COMPSCI 1026A/B Full Course Notes
Verified Note
26 documents

Document Summary

Lists are the fundamental mechanism in python for collecting multiple value. It is a container that stores a sequence of values. Here we created list and specify the initial values that are to be stored in the new list. The square brackets indicate that we are creating a list. 6. 1. 2: accessing list elements: a list is a sequence of the elements, each of which has an integer position or index. To access a list element, you specify which index, i, you want to use, using the notation list[i: a. there are two difference between lists and strings. Lists can hold values of any type, whereas strings are sequences of characters. b. Moreover strings are immutable- you cannot change the characters in the sequence. You replace one list element with another, like this: values [5] = 87. You can use the len function to obtain the length of the list, that is, the number of the elements.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents