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

PS 3, problem 2 question: What should be returned if key string is empty?

OpenStudy (anonymous):

The issue I'm mainly having is with problem 3, as it depends on the results of my work for problem 2. Looking at problem 3, it seems like problem 2 would need to return a tuple of all the indexes in the target string, but that seems really wrong, intuitively.

OpenStudy (anonymous):

Ah well, I just modified my function from problem 2 and included it in problem 3's .py file.

OpenStudy (anonymous):

PS 3 problem 4. gave me some problems...I ended up scrapping my entire preliminary work and redid the whole prob. set. I'm still not happy with my code though and will rework it after PS4. Keep it up Keen!

OpenStudy (anonymous):

It doesn't have to return anything. You can either use an 'if' statement to return None or something from the ps3.2 function, or you could structure the code that feeds that function to recognize empty keystrings and not pass them in.

OpenStudy (anonymous):

For the subStringMatchOneSub function that's included in ps3_template.py to work properly, subStringMatchExact(target, "") needs to return range( len(target) ), where 'target' is a string of some sort. If it returns None or an empty tuple, then subStringMatchOneSub doesn't work. It'll crash with a TypeError if subStringMatchExact(target, "") returns None, actually. Also, if you run subStringMatchOneSub with the key being a 2 character string, it will find nothing if subStringMatchExact(target,"") returns an empty tuple.

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!
Latest Questions
desss: are any of yall good at mathh!!??
just now 1 Reply 0 Medals
demonwolftwin: who was the 2rd presseddent
2 hours ago 1 Reply 0 Medals
Tbone: I made one last edit I'ma stop making them for a while
27 minutes ago 22 Replies 8 Medals
yomomalikebracobama: e
5 hours ago 6 Replies 1 Medal
yomomalikebracobama: help u tigers
5 hours ago 10 Replies 2 Medals
Williammcgeorge: does anyone want to see some of my drawings
2 hours ago 19 Replies 4 Medals
Joe348: Math 4 Vectors/Vectors Applications
6 hours ago 2 Replies 1 Medal
Joe348: Math :(
6 hours ago 20 Replies 4 Medals
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!