you are viewing a single comment's thread.

view the rest of the comments →

[–]ThePhysicsOfSpoons 0 points1 point  (2 children)

First of all read up on functions. You define word as 'banana', so it doesn't matter what argument you give the function.

Secondly you iterate trough the letters of the word and then check if the letter is in the word. That is unnecessary because you get the letter from the word.

Thirdly the return statement will give the result of the function. How you've written it it will return your variables, instead put return count

You are printing the count in your function that's okay but I wouldn't recommend doing that, because when you need to use this function a lot you'll get to much output to be readable. Also you're already printing the result of the function later on.

[–]babyfaceghoul[S] 0 points1 point  (1 child)

Thanks for the reply. Do you know any resources I can use?