Module 1

Variables

Give a name to a value.

Give a value a name

A variable is a name that points to a piece of stored information. Instead of repeating a value, you store it once and use its name.

A variable in memory
sequence
"ATGC"
stored value
The name "sequence" points to the stored text "ATGC".
PythonCreate a variable, then print it.
sequence = "ATGC"
print(sequence)
ATGC

The = sign stores a value. We read it as: *store the value on the right under the name on the left.* It does NOT mean "equals" the way it does in math.

Biology connection

Storing a DNA sequence in a variable is the start of analyzing it. Later you'll compute its length, count bases, and even translate it into a protein — all by referring to the name.

PythonVariables can store protein sequences too.
protein = "MKWVTF"
print(protein)
MKWVTF
Your task

Create a variable

  • Create a variable named sequence with the value "ATGC".
  • Then print sequence.
Remember

name = value stores a value under a name. The name is the variable, and later you use the name to reach the value.