# Lab Worksheet 9¶

Problem 1: The list mylist defined below contains 10 entries, some of which are numbers (integers and floats) and some of which are strings. For this question, you will determine the mean value for all numeric entries in this list. To accomplish this goal, write a for-loop that iterates over each entry in the list. Your code should print a final statement that reads, "The mean of all numbers in the list is X" (where X has been properly replaced with the mean).

Hint - when solving this question, these functions may be useful: type(), len(), and sum().

In [2]:
mylist = ["hello", 89.21, -3, "goodbye", 21, 0.0056, -12.34, "thank you", "please", 999.44409]



Problem 2: Write a function to calculate the counts of A's, C's, G's, and T's in a DNA sequence. Your function should take a single argument (a string of a DNA sequence) and return a dictionary of nucleotide counts. For example, if the argument "ACGTACGT" is provided, the function should return this dictionary: {"A":2, "C":2, "G":2, "T":2}. Once your function has been written, run the function on the the provided dna_string string given below, and print the returned dictionary.

Hint - use the string method .count() as part of your solution.

In [4]:
# Your code goes here.

# Variable to call the function on:
dna_string = "ATCGAGCTATACCGATACAGGCTGGTATAAAAGATTC"

In [ ]: