ubuntu2004
Exercise 4.1
Assign the value of 45 to the variable named number_of_flies
.
Exercise 4.2
Print out the type of the variable number_of_flies
.
Exercise 4.3
Increment the variable number_of_flies
by 12 and print its new value.
Exercise 4.4
Scientists counted the number of emperor penguins that joined an Antarctic breeding colony on each day for a whole season. The first three day's records are given in the following table
Day | New colonists |
---|---|
1st March | 10 |
2nd March | 156 |
3rd March | 73 |
Using a variable called number_penguins
print out the cumulative number of penguins in the colony on each of the first three days. Use the operator +=
to increment the variable.
Exercise 4.5
Each strand of DNA is made up of four bases: thymine (T), adenine (A), guanine (G) and cytosine (C).
The GC content of a strand of DNA is the percentage of bases that are either guanine or cytosine. The GC content can vary widely between different regions of an organism's genome and also varies widely between different organisms. GC content is often of interest to biologists as it can indicate the presence of DNA that may have originated from another organism's genome.
Complete the following code to calculate the GC content of a particular DNA sequence and print its value to 1dp.
Exercise 4.6
Complete the code below using an f-string to insert the string variables into the printed string:
Exercise 4.7
Using the variable Fahrenheit
below, write code to convert it to degrees Celsius and print the answer to 1dp. The conversion equation is