hey everybody

Hi everybody. It's me again. And I'm still stuck on the same code despite all your effort to help me. I'm sorry. But could someone please explain to me why this what I'm currently doing isn't working. I honestly don't understand. Here's the link again, but I made a few changes.

Here's the link: https://repl.it/@FARHEENPALAGIRI/Delete-every-third-character

You are viewing a single comment. View All
a5rocks (782)

Here is something that should work. It uses modular arithmetic to find the third character, and uses continue to skip an interation. Both these are great tools, and I think you should check them out. Anyway, here :

start = input('Your string? ')
end = ''
for i in range(len(start)):
  if i%3 == 2:
  end += start[i]

Another thing is that you should join the repl.it discord (https://discord.gg/XadDsju), in which you would be able to get more comprehensive help.

Nanashi (7)

@a5rocks Extremely close, just that the question specifies deletion of indices divisible by 3. Yours is the solution for deletion of every third character, though to be honest that sounds like a more likely problem.

input    0123456789abcdefghij
i%3==0    12 45 78 ab de gh j
i%3==2   01 34 67 9a cd fg ij
a5rocks (782)

@Nanashi Oh sorry, must have misread the question. Good catch though :D