Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

RCMorea

  • one year ago

I am working slowly through this course, doing both the assignments and the "finger exercises" in the book. I am now on finger exercise 3.2, which gives a string of numbers separated by commas, and asks they be added togther. The book demonstrates how to do this with a string not separated by commas. The lectures have shown how to do it with a list. A string separated by commas is something I have not seen an example of. Did I miss it? Is the expectation to Google it? I don't mind doing that, I'm just wondering whether I missed something...

  • This Question is Closed
  1. RCMorea
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    BTW, sorry for the double post (I put it in Comp Sci, not realizing there is a separate space for the MIT 6.00). It's a wonder I can tie my shoes let alone program, but I struggle through.

  2. bwCA
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 1

    i would think that you have to put those strings into a data structure. either a list, or a tuple or a dictionary or a set. a sequence data type most likely. perhaps the split() string method might help. http://docs.python.org/2.7/library/stdtypes.html#str.split And a walk thru the Tutorial in the help docs wouldn't hurt: http://docs.python.org/2.7/tutorial/index.html

  3. RCMorea
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    bwCA, Thanks. I did wind up using .split on the string to generate an equivalent list of floats. It just seemed the data could have been provided in list form to begin with as easily as string form, so converting from string to list seemed like possibly missing the point. Especially since I don't recall the professor or TA talking about such conversions. But that is what I did and it worked. Thanks!

  4. bwCA
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 1

    The purpose of the course is not to teach you the Python programming language - it is to teach you computer science and programming methods. They expect you to avail yourself to the wealth of help and documentation available for the language itself.

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

    Search OpenStudy
    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

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.