Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 17 Online
OpenStudy (anonymous):

I want to do that: seq1 = "atgctaaggt" i want to count number of a's for example. I am using python 3.2 and i can't make the count command. Thanks a lot

OpenStudy (anonymous):

I believe that lesson makes use of find(string, key, position), but if you just want to count letters here is a simple loop: ctr = 0 seq1 = "atgctaaggt" for letter in seq1: if letter == 'a': ctr += 1 print 'There are', ctr, 'a\'s in this sequence'

OpenStudy (anonymous):

I tried it and it worked. But this means if i need to count g or t or c's in the same seq1 i need to make different codes. Thanks

OpenStudy (anonymous):

So the course example code is all geared to Python 2.x - the instructions say DON'T use 3.x or the examples might not work - you add a layer of complexity to debugging by using 3.x It is probably safe to assume that most of us taking this course are just learning 2.x and don't know what the differences are. paste your code at dpaste.com then post the link here

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!