SHARE
TWEET

Untitled

a guest Feb 20th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def get_complement(nucleotide):
  2.     ''' (str) -> str
  3.  
  4.    Return the nucleotide's complement.
  5.  
  6.    >>> get_complement('A')
  7.    'T'
  8.    >>> get_complement('G')
  9.    'C'
  10.    '''
  11.    
  12.     if nucleotide == 'A':
  13.         return 'T'
  14.     elif nucleotide == 'T':
  15.         return 'A'
  16.     elif nucleotide == 'G':
  17.         return 'C'
  18.     elif nucleotide == 'C':
  19.            return 'G'
  20.    else:
  21.         print("Input is not a valid nucleotide")
  22.    
  23. def get_complementary_sequence(dna):
  24.     ''' (str) -> str
  25.  
  26.    Return the DNA sequence that is complementary to the given DNA sequence.
  27.  
  28.    >>> get_complementary_sequence('ACTG')
  29.    'TGAC'
  30.    >>> get_complementary_sequence('GGTACTG')
  31.    'CCATGAC'
  32.    '''
  33.     for nucleotides in dna:
  34.         return get_complement(dna)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top