I can just use return?

How am i supposed to know from the introduction on this lesson that i can just type : return letter in word?? Also i have no idea how :

Write a function called common_letters that takes two arguments, string_one and string_two and then returns a list with all of the letters they have in common.

Is equal to:
def common_letters(string_one, string_two):
common =
for letter in string_one:
if (letter in string_two) and not (letter in common):
common.append(letter)
return common

I am so so so lost. I dont understand loops at all and now strings are killing me. I feel like I am too stupid to understand the lessons.

4 Likes

Did you not read the white column with the exercise-specific guide on the left? Not to mention, what you wrote works perfectly well, so I think you’re doing fine.

(Don’t mind me, I’m just here to complain about the compiler throwing TabErrors and IndentationErrors at me left and right.)

2 Likes

I’m glad I’m not alone in all this. I need to check out these community pages more often, since apparently I’m not alone in my constant misery going through these exercises.