This code performs roughly twice as much work as is necessary.
Every iteration tests if the word is 'needle' or not.
If the word is 'needle' the value of the expression returned is calculated, which is the first occurence of the string 'needle' in haystack, effectively nearly doubling the work.
If the input is the following list the work is exactly doubled: ['pin', 'sword', 'knife', 'needle'].
This code performs roughly twice as much work as is necessary.
If the input is the following list the work is exactly doubled: ['pin', 'sword', 'knife', 'needle'].
Same Bro!
Same. Not really sure what that means.