Hi, I'm a beginner.... I have tested this code in python. It works with the input that Leetcode says incorrect. I cannot figure it out. Anyone can help?

Thanks!

'''

```
def reverseWords(self, s):
if s is None:
return False
b=list(s)
idx = [i for i, value in enumerate(b) if value is ' ']
wor = {}
idx = [-1] + idx + [len(b)]
for n in range(len(idx)-1):
wor[n] = ''.join(b[idx[n]+1:idx[n+1]])
r_wor = ''
for n in range(len(wor)-1,-1, -1):
r_wor_temp = wor[n]
if n == 0:
r_wor += r_wor_temp
else:
r_wor += r_wor_temp + ' '
s= r_wor
```

'''