Feb-11-2018, 02:38 PM
Hi,
A friend is mentoring me on python (thus the world list we are using)
My challenge is in 1 line code to find all the words that have s in them.
I am fairly new to list comprehensions but are starting to get them. At my level, right now, what works best is actually writing out the logic in 2 or 3 lines then once i see it written down turning that into a list comprehension.
My question is why is find returning leon in this challenge and not sucks?
mikes
balls
A friend is mentoring me on python (thus the world list we are using)
My challenge is in 1 line code to find all the words that have s in them.
I am fairly new to list comprehensions but are starting to get them. At my level, right now, what works best is actually writing out the logic in 2 or 3 lines then once i see it written down turning that into a list comprehension.
My question is why is find returning leon in this challenge and not sucks?
original_list = ['leon', 'sucks', 'mikes', 'balls'] for x in original_list: if x.find('s'):leon
mikes
balls