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

 

mic@mathcs.emory.edu lab2 > count_codons
prev  |  next  |  chance

Given strings x and s, where s has length 3, count the occurrences of s as a substring of x, starting at an index which is a multiple of 3. (Hint: the range() function can take three arguments, try range(0,10,3).)


count_codons('agctagctagctagctagcta', 'agc') → 2
count_codons('agctagctagctagctagcta', 'cta') → 2
count_codons('agcagcagcagc', 'agc') → 4

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

def count_codons(x, s):

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

Difficulty: 200

Copyright Nick Parlante 2017 - privacy