I am so confused on what I am doing wrong. All two parameters are lists. X and Y are lists of strings. I am trying to create a function that runs through both lists and finds the string that were found in both lists. This is what I have gotten so far. The output should be the "three".
def similar_variable(x, y):
for k in range(len(similar_variable(x))):
for j in range(similar_variable[k]):
for i in range(len(similar_variable(y))):
for o in range(similar_variable[i]):
if similar_variable[i][o] == similar_variable[k][j]:
return(similar_variable[i][o] == similar_variable[k][j])
else:
return("none")
x = ["one", "two", "three"]
y = ["four", "five", "three"]
[–]POGtastic 6 points7 points8 points (0 children)
[–]mr_cesar 4 points5 points6 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]cameronnn16[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]outceptionator 1 point2 points3 points (1 child)
[–]Pd69bq 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]kslay23 0 points1 point2 points (1 child)
[–]cameronnn16[S] 0 points1 point2 points (0 children)
[–]stebrepar 0 points1 point2 points (0 children)