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]:
        same.append(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]

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

[details="is_odd"]
[spoiler]
```
def is_odd(x):
    return x % 2 and True
```
[/spoiler]
[/details]
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]   
list.index()

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