Why in my code i get {“a”, “n”} instead of [“a”, “n”]
def common_letters
(string_one, string_two):
letters =
for
L in
string_one:
if
L in
string_two:
letters += L
letters.sort()
return
set(letters)
Why in my code i get {“a”, “n”} instead of [“a”, “n”]
def common_letters
(string_one, string_two):
letters =
for
L in
string_one:
if
L in
string_two:
letters += L
letters.sort()
return
set(letters)
The return value is a set; ergo, the delimiters, {
and }
.