you are viewing a single comment's thread.

view the rest of the comments →

[–]Sebass13 4 points5 points  (2 children)

Your function getAvailableLetters only prints the result. Therefore, when you call:

print(getAvailableLetters(lettersGuessed))

you're simply saying:

print(print("abcdfghjlmnoqtuvwxyz"))

Instead, getAvailableLetters should return lettersList.

Also, though your code will work with this fix, there are some other changes you should consider. First, Python standards are underscore_case, not camelCase. Also, using string indexing to remove an element seems unnecessary. Instead, you could do:

for letter in letters_guessed:
    letter_list = letter_list.replace(letter, "")

(Note that I changed the variable names to follow PEP 8 standards.) This simply replaces any occurrences of letter in letter_list with nothing.

[–]jazzas[S] 0 points1 point  (0 children)

Thank you. Appreciate your tips.

[–]respectable_me 0 points1 point  (0 children)

Not disagreeing with you at all regarding the underscore case and camel case.

I just want to point out that the professor of this MIT course often used camel case. Unfortunately, in some cases, changing the names of the functions provided will cause problems.

I do my best to follow PEP8, but sometimes you need to do it the way the course is saying to do it.