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
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'
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
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
Join our real-time social learning platform and learn together with your friends!