Currently i am doing the weird case problem in cordwarrior. the problem is that Write a function toWeirdCase (weirdcase in Ruby) that accepts a string, and returns the same string with all even indexed characters in each word upper cased, and all odd indexed characters in each word lower cased. The indexing just explained is zero based, so the zero-ith index is even, therefore that character should be upper cased.

I wrote the function.It successfully swap the case of single word,But don't work for multiple words or a sentence,So i thought about to apply swapcase but it swaped all the words of the sentences which is not desirable.So i can not figure out which condition may suitable for this::

```py
   def to_weird_case(string):
    tot=""
    for i in range(len(string)):
        if i%2==0:
             tot+=string[i].upper()
        if i%2==1:
             tot+=string[i].lower()

    if string[i]==" " or i%2==1:
       to_weird_case(string[i:])
    return tot   

```

error i got this type:

```
 toWeirdCase
 should return the correct value for a single word (8 of 8 Assertions)
 should return the correct value for multiple words
'ThIs iS A TeSt' should equal 'ThIs Is A TeSt'
'LoOkS LiKe yOu pAsSeD' should equal 'LoOkS LiKe YoU PaSsEd'
'ThIs iS ThE FiNaL TeSt cAsE' should equal 'ThIs Is ThE FiNaL TeSt CaSe'
'JuSt kIdDiNg' should equal 'JuSt KiDdInG'
'Ok fInE YoU ArE DoNe nOw' should equal 'Ok FiNe YoU ArE DoNe NoW'\

```

link to the problem:<https://www.codewars.com/kata/52b757663a95b11b3d00062d/train/python>

I thought about a another approach that to divide the sentence and apply the function on each word.

```py

   def swap(string):
    tot=""
    for i in range(len(string)):
        if i%2==0:
             tot+=string[i].upper()
        if i%2==1:
             tot+=string[i].lower()
    if i%2==0:
        swap(string[i])
    return tot

  def to_weird_case(string):
      new=""
      for j in string:
          print(swap(j))
  print(to_weird_case('ThIs iS A TeSt'))

```

but it make all word uppercase.