Assignment
Practice writing some python functions. Remember to write tests, and include documentation strings and comments in your code.
1) Write a python function that given two numbers \(a\) and \(b\), \(a < b
< 10000\), returns the sum of all odd numbers between \(a\) and \(b\). For
example, sum_odds_in(3, 10) should be \(3+5+7+9 = 24\). Hint a
number \(n\) is odd if n % 2 == 1.
2) Write a python function that given a string of DNA nucleotides
("A", "C", "G" or "T") returns the percent GC of the given string. For
example percent_gc("GGATACA") should be approximately 42.85%.
3) Write a python function palindrome that given a string,
determines if the string is a palindrome, a string that reads the
same forwards and backwards. For example "AMANAPLANACANALPANAMA" is a
palindrome. Hint think about how you could use range(len(s)) to
check the value of each letter of the string s, and what you could
compare it to.
4) The sum of the squares of the first ten natural numbers is,
The square of the sum of the first ten natural numbers is,
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is
.
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.