ubuntu2004
Exercise 20.1
Write a function called reverse_string()
which prints the reverse of a string passed to it.
The call to the function is already included in the following code cell. You just need to write the function.
Hint: See Notebook 6 for how to reverse a string
Exercise 20.2
Write a function called average()
that takes a list as an argument and prints out the average values in the list.
Hint: See Task 3.10 if you have forgotten how to calculate the average of a list of values.
Exercise 20.3
Write a function called multiply_two_numbers()
that prints the product of two number passed to it.
Exercise 20.4
Write a function called count_bases()
that takes two arguments. The first argument is a DNA sequence and the second is a string of the bases to be counted. If the second argument is missing then all bases should be counted.
The function should print the count of the specified bases.
Hint: Reuse the code in Notebook 13 on Nested loops