Module 4

String length

How many characters are in a string.

Measuring text

The len() function counts the number of characters in a string. For a DNA sequence, this is the number of bases.

Python
seq = "ATGCGTA"
print(len(seq))
7
1A
2T
3G
4C
5G
6T
7A
Each box holds one character. len() counts them.
Your task

Measure a sequence

  • Store ATGCGTA in a variable and print its length.