id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

david.white@denison.edu cs111fall2019 > ssr
prev  |  next  |  chance

A microsatellite or simple sequence repeat (SSR) is a repeat of a short sequence of DNA. The repeated sequence is typically 2-4 bases in length and can be repeated 10- 100 times or more. For example, 'cacacacaca' is a short SSR of 'ca', a very common repeat in humans. Microsatellites are very common in the DNA of most organisms, but their lengths are highly variable within populations because of replication errors resulting from "slippage" during copying. Comparing the distribution of length variants within and between populations can be used to determine genetic relationships and learn about evolutionary processes. Write a function ssr(dna, repeat) that returns the length (number of repeats) of the first SSR in dna that repeats the parameter repeat. If repeat is not found, return 0. For examples, return anything and click "Run" to see the test cases. You can assume dna and repeat are lowercase, non-empty, and dna is longer than repeat.


ssr('agtcacacacacacacacatgggcaacacacacattg', 'ca') → 8
ssr('agtcacacacacacacacatgggcaacacacacacacacacacacacacacattg', 'ca') → 8
ssr('agcttttcattctgactgcaacgggcaatatgtctctgtgtggattaaaaaaagaggaggaggaggaggaggaggaggaggaggagtgtctgatagcagcttctgaactggttacctgcc', 'gag') → 11

...Save, Compile, Run (ctrl-enter)

def ssr(dna, repeat):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Post-solution available

Copyright Nick Parlante 2017 - privacy