Variables in Python in the biological context
There are four main types of variables in Python [ or any other programming language], those are [ String, Integer, Float, and Boolean].
A string variable is a text data assigned to a variable as shown below:
>>> DNA = "TCGA"
>>> print(DNA)
>>> TCGA
An integer variable ,on the other hand, is a numerical variable that contains whole number data, as shown below:
>>> print(DNA.count("A"))
1
a float variable holds numeric data with decimal places, like:
>>> 1/4
0.25
>>> print("A ratio :", (1/4)*100, "percent")
A ratio : 25.0 percent
while boolean variables are used in logical tests and statements, like:
>>> if (True):
print("A" in DNA)
True
or
>>> if (True):
print("U" in DNA)
False
this is summarized in the link video below:
Variables_LINK
No comments:
Post a Comment