## Write a function which outputs two output strings from a single input string the first string is all the odd place characters and second string all the even characters.

Report
Question

### Please briefly explain why you feel this question should be reported .

Write a function which outputs two output strings from a single input string the first string is all the odd place characters and second string all the even characters. For

example:

if the original string is “computer”, string 1 returns “cmue” and string 2 returns “optr”

if the original string is “agbhcidjekfl” string 1 returns “abcdef” and string 2 returns “ghijkl”

in progress 0
Python 6 months 4 Answer 476 views 0

1. ### Please briefly explain why you feel this answer should be reported .

```def str_even_odd(word):
#length of the string
i = 0
slen = len(str(word))
even_str = ''
odd_str = ''
while i < slen:
mod = i % 2
if mod > 0:
even_str = even_str+word[i]
else:
odd_str = odd_str+word[i]
i=i+1
return "Odd String: "+odd_str+" :: "+"Even string: "+even_str

print(str_even_odd("computer"))

print(str_even_odd("agbhcidjekfl"))
```

Output :
Odd String: cmue :: Even string: optr
Odd String: abcdef :: Even string: ghijkl

2. ### Please briefly explain why you feel this answer should be reported .

Outputs :
‘Odds:’, ‘optr’, ‘ :: ‘, ‘Even:’, ‘Cmue’
‘Odds:’, ‘ieydn’, ‘ :: ‘, ‘Even:’, ‘Ncl_oe’

3. ### Please briefly explain why you feel this answer should be reported .

```name='pythonevenoddtest'
even_str=''
odd_str=''
for i in range(0,len(name),2):
even_str=even_str+name[i]
if i &lt; (len(name)-1):
odd_str=odd_str+name[i+1]
print(even_str)
print(odd_str)
```
4. ### Please briefly explain why you feel this answer should be reported .

```def even_odd(string):
i = 0
for x in string:
if i % 2 == 0:
evens.append(x)
else:
odds.append(x)
i += 1

print "".join(evens)
print "".join(odds)
```