I'm I loosing it? I'm on Prob Set 4.1 and I believe the solution is quite straighforward, but I am confused on something on the result I'm getting.

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions.

A community for students.

I'm I loosing it? I'm on Prob Set 4.1 and I believe the solution is quite straighforward, but I am confused on something on the result I'm getting.

MIT 6.00 Intro Computer Science (OCW)
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

my code is : def get_word_score(word, n): score = 0 if len(word) == n: score += 50 for letter in word: print letter score += SCRABBLE_LETTER_VALUES[letter] print score
with get_word_score('waybill', 7) as my input, I get an output of: w 54 a 55 y 59 b 62 i 63 l 64 l 65 Shouldn't I just get the last score of 65 since the print statement is outside of the for loop? If I indent the print score statement to be on the same indentation as the print letter I get an unexpected indent error. I am confused!
I realized I posted the wrong code above. It should be: def get_word_score(word, n): score = 0 if len(word) == n: score += 50 for letter in word: print letter score += SCRABBLE_LETTER_VALUES[letter] print score

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Yes, but get_word_score needs to return the score, not print it.
Thanks for the reply! I know it's to return rather than print score, I just wanted to make sure it was the correct value. To solve my issue I had to manually retype the function for it to work. Very odd. Some voodoo going on :)
You might have had a tab issue. I've had a piece of code that looks correct, but I had to entirely retab it because somewhere a space was messing up the entire code.

Not the answer you are looking for?

Search for more explanations.

Ask your own question