CSCI 1105 Lecture Notes - Lecture 14: Concatenation

78 views2 pages
Verified Note

Document Summary

To use the for loop for traversing lists. A list is a sequence of elements which all share the same variable name, but referenced by an index. This is similar to a string, but we can pull out each independent element of a list. If you know any other programming language, this is similar to an array. We specify a list variable with the subscript [] morevalues = [] values = [32, 54, 67, 29, 80, 115] we can modify what is in a position, too. values[i] = 0. To access a list element, specify which index you want to use. This is done with the subscript operator in the same way that you access individual characters in a string. You can have any elements in the list, all with the same or different type. Both lists and strings are sequences, and we can use square brackets to access anything from either.

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

Related Questions