My solution

here’s my solution

def same_values(lst1, lst2):
  same = []
  i = 0
  if len(lst1) == len(lst2):
    for num in lst1:
      if lst1[i] == lst2[i]:
      i = i + 1
    return same

@bitplayer30925 Man. Please stop posting the answers

Sorry - didn’t realize that’s a faux pas. Just wanted to document one method of completion, since I like looking at how others solve.

I can obscure the solutions.

Yes, that would be good idea. Please do so.

How to obscure solutions?

Use [details="name"] to create a show/hide block. Close it with [/details].

Use [spoiler] to convert code to a PNG that cannot be copied. Close it with [/spoiler]

def is_odd(x):
    return x % 2 and True

def is_odd(x):
    return x % 2 and True
1 Like

Please critique my solution. After a lot of tinkering, I managed to get it to work in a list comprehension:

def same_values(lst1, lst2):
  return [lst1.index(x) for x, y in zip(lst1, lst2) if x == y]   

will always give the index of the first instance in the list. It won’t reach any other duplicates.