A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

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

  • This Question is Closed
  1. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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'

  2. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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

  3. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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

  4. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.