Module 1
Text and strings
Text is called a string.
Text inside Python
When you write text in Python, you surround it with quotation marks. This piece of text is called a string (short for string of characters).
Python"ATGC" is a string.
print("ATGC")→ ATGC
Biology connection
In bioinformatics, a DNA sequence can initially be represented in Python as text: "ATGCGT". Python calls this a string, or str for short.
PythonEven a single character in quotes is a string.
print("A")→ A
A common mistake
Forgetting the closing quote makes Python throw a SyntaxError. The error panel will try to explain it. If you see it, check that every opening quote has a matching closing one.
Your task
Print a string
- Print the DNA sequence ATGC as a string.
- Remember the quotation marks.
Remember
A string is text inside quotes. Python remembers it exactly as you write it, including spaces.