ubuntu2004
Exercise 12.1
Loop through the following list and print out each word.
Exercise 12.2
Loop through the following list and print out the reverse of each word.
Exercise 12.3
Loop through the following list of DNA sequences. Test and print if the start codon "ATG" is in each sequence.
Exercise 12.4
Loop through the following list of measurements of female haemoglobin levels. Test and print if each measurement is between the normal values of 11.6 and 15.0 g/dl.
Exercise 12.5
The number of items in a list is given by the len()
function.
Write your own code that counts the number items in a list and prints it out.
Test your code on any of the lists in these exercises.
Exercise 12.6
Create an new list called squares
of the squares of each number in the list numbers
below. That is, the new list should be [1, 4, 9, etc.]
.
Hint: Create an empty list, loop through the list
numbers
and append the square of each number to the new list.