Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

LoveMathFermat Group Title

Hi! Fellow OCW students! I am trying to solve problem 3 on the problem set 3. I keep getting error messages. I don't see why. Could you guys pick that out? http://pastebin.com/5DfgyJ3M Thanks!

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. Chris2332 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    What's the error messages?

    • 2 years ago
  2. rsmith6559 Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    MatchPair is declared as a tuple. Tuples are immutable ( can't be changed ). A list would work better.

    • 2 years ago
  3. bookworm00981 Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    whats the error?

    • 2 years ago
  4. LoveMathFermat Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Hi! guys. The error message is following: Traceback (most recent call last): File "<pyshell#48>", line 1, in <module> subStringMatchOneSub("abcabcabcabcd","bc") File "/Users/piljoomoon/Documents/HW3.py", line 108, in subStringMatchOneSub filtered = constrainedMatchPair(match1,match2,len(key1)) File "/Users/piljoomoon/Documents/HW3.py", line 44, in constrainedMatchPair for second in range(0,len(secondMatch)): TypeError: object of type 'NoneType' has no len() Thank you for your help!

    • one year ago
  5. rsmith6559 Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    Sounds like secondMatch is either not declared, or it REALLY isn't what you think it is, so whatever is setting it's value isn't working properly.

    • one year ago
  6. LoveMathFermat Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    hm..I am sure that secondMatch is a list. In what situation do you get this error? can you guys give me an example? : TypeError: object of type 'NoneType' has no len()

    • one year ago
  7. rsmith6559 Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    The easy way to prove it is to print secondMatch in line 43 of constrainedMatchPair. If that errors, guess what. If it doesn't, study what's printed to make sure that it's list syntax. IMO, during debugging, when in doubt, print it out.

    • one year ago
  8. LoveMathFermat Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Thanks guys for the help!

    • one year ago
    • Attachments:

See more questions >>>

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.