works, i still feel like you've completely missed what you were actually doing wrong with your attempt at 'find'.
try this:
string = "test"
print(string.find("x")) # returns -1
print(string.find("t")) # returns 0
print(string.find("e")) # returns 1
print(string.find("s")) # returns 2
see what find returns? a NUMBER. not a boolean. if the character you're trying to find is the first thing in the string, then the string function will return zero.
if you pass zero to a bare if:, then it will be interpreted as false, as manav showed you. you're passing a zero to an if and then wondering why it didn't work... this is why i was suggesting you have a think about the difference between 'if x:' and 'if x >= 0:' with respect to what string find actually returns.
what were they trying to do exactly o.O
Yeah i forgot that find gives numbers as resault in my mind i thought it would give true or false now i got it
Обсуждают сегодня