Problem 1: Create a list with your favor amino acids (use Google if you can't remember your amino acids); your list should have at least 5 amino acids. Then, complete the following steps using Python.
len()
to find the number of items in the list..remove()
.len()
again.)append()
.# create a list containing amino acids
# ---your code here---
# sort the list alphabetically
# ---your code here---
# find the length of the list
# ---your code here---
# remove amino acid(s) from the list
# ---your code here---
# find the new length of your list
# ---your code here---
# add selenocysteine to your list
# ---your code here---`
Problem 2: Create a dictionary using the amino acids from the first (unedited) list you created above, where the amino acid is the key and their one-letter code is the value (use Google to find the one-letter codes if you can't remember them). Then, complete the following steps using Python.
for
loop. # define a dictionary where the keys are the amino acids
# and the values are the one-letter codes
# ---your code here---
# add a 'selenocysteine' key to the dictionary
# give it a one-letter code (value) of 'U'
# ---your code here---
# remove a key-value pair from the dictionary
# ---your code here---
# define an empty string
# ---your code here---
# loop through the values (letters) in the dictionary
# and add each letter to the string
# ---your code here---
IF THAT WAS EASY...
Problem 3: Using only list indexing and the string function split()
, write code that extracts the weight (here the number 7) from data_string
defined below, and print out the result. What is the type of your final result? Use Python's type()
function to find out.
data_string = "height: 15; weight: 7; width: 5;"
# ---your code here---
Problem 4: Using only string indexing, write code that does each of the following. In each case, store the result in a new variable and print its contents.
data_string
.data_string
.data_string
and combine them into a single, new string that should look like this: "abcdefghijklmnopqrstuvwxyz0123456789"data_string
(the lower-case e) with a captial X. Do not use the function replace()
.data_string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
# extract the first 10 characters
# ---your code here---
# extract characters 27-52
# ---your code here---
# extract characters 1-26 and 53-62
# ---your code here---
# replace e with X
# ---your code here---
# turn the previous string to uppercase
# ---your code here---