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

6-00SC(2011) Problem#4 of Problem set 4. Hi. After two days of wrecking my brain I've come up with a partially correct (mostly incorrect) code. If anyone can describe what i'm doing wrong or can share the correct version, i'd greatly appreciate it. At this point all I want is to see the code work. The code is posted on the comment below

OpenStudy (anonymous):

I say partially correct because of the following output >>> s = apply_shifts("Do Androids Dream of Electric Sheep?", [(0,6), (3, 18), (12, 16)]) >>> s 'JufYkaolfapxQdrnzmasmRyrpfdvpmEurrb?' >>> shifts = find_best_shifts_rec(wordlist, s, 0) >>> shifts [(0, 6), [(3, 18), [(9, 16), [(6, 0), [(3, 0), None]]]]] the correct version should be giving me: [(0,6),(3,8),(12,16)]

OpenStudy (anonymous):

*the correct version should be giving me: [(0,6), (3,18), (12,16)]

OpenStudy (rsmith6559):

First, is s correct after apply_shifts()? find_best_shifts is returning a list of tuple and list of tuple and list of tuple and list of tuple and list of tuple and None. So however you're iterating (iterating or recursion) at the top level has issues.

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!
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!