You are viewing a single comment's thread. Return to all comments →
This solution works on PyCharm, but when I submit the code, it is rejected. Why??
def print_even_odd_characters(s):
even_characters = [] odd_characters = [] for i in range(len(s)): if i % 2 == 0: even_characters.append(s[i]) else: odd_characters.append(s[i])
print("".join(even_characters), "".join(odd_characters))
if name == "main": s = input() print_even_odd_characters(s)
Seems like cookies are disabled on this browser, please enable them to open this website
Day 6: Let's Review
You are viewing a single comment's thread. Return to all comments →
This solution works on PyCharm, but when I submit the code, it is rejected. Why??
def print_even_odd_characters(s):
even_characters = [] odd_characters = [] for i in range(len(s)): if i % 2 == 0: even_characters.append(s[i]) else: odd_characters.append(s[i])
print("".join(even_characters), "".join(odd_characters))
if name == "main": s = input() print_even_odd_characters(s)