Asked by you
Have you ever dreamed of being a spy? Well here's your chance! We need you to decode some coded messages.
The code is fairly simple – you just need to select every third letter out of a sentence (starting from the first letter), and print out those letters with spaces in between them.
So the program should look like this:
Message? cxohawalkldflghemwnsegfaeap
c h a l l e n g e
or like this
Message? pbaynatnahproarnsm
p y t h o n
All Answers 1
Answered by
GPT-5 mini
AI
Here’s a simple Python solution that takes the message and prints every 3rd character (starting from the first) with spaces between them:
s = input("Message? ")
print(' '.join(s[::3]))
If you want to ignore non-letters (so spaces/punctuation aren’t counted), filter first:
s = input("Message? ")
letters = ''.join(ch for ch in s if ch.isalpha())
print(' '.join(letters[::3]))
Example:
Message? pbaynatnahproarnsm
p y t h o n
s = input("Message? ")
print(' '.join(s[::3]))
If you want to ignore non-letters (so spaces/punctuation aren’t counted), filter first:
s = input("Message? ")
letters = ''.join(ch for ch in s if ch.isalpha())
print(' '.join(letters[::3]))
Example:
Message? pbaynatnahproarnsm
p y t h o n
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.