Strings

Strings is a series of characters (numbers, letters, etc), one example of a string is your name or your id because strings can contain both numbers and letters.

The following are all examples of strings being used in code, in this case, within print functions.

print "hello"
print '123456789'
print "hello123456789"

Lists

Lists are sequences of elements with each element being a variable. An example of a list can be the names of the students in this classroom.

Features of Lists

  • The elements within the list can be accessed by index.
  • Can store various elements
  • The list is in order

Example of a list and how it can be used

thanksgivingList = ["cranberry pie", "casserole", "mashed potatoes", "turkey"] // this is the list in which each 

List Index

An index is an element of a string. Indices typically start with 0, but Collegeboard has the index start at 1.