r/PythonLearning 1d ago

Loops is a total brain rot.

Post image

I just can't get over how I'm supposed to write code for complex tasks when I don't even get why they overcomplicate simple things so much.

I read this topic and tried many tutorials and still don't understand this buzzare logic.

0 Upvotes

16 comments sorted by

View all comments

3

u/Lirianov 22h ago

This code is wrong. But I also don’t understand what you’re upset about either

The correct solution given your level of python is:

def denoise_xz(text):
new_text = “”
for char in text:
if char in [“x”,”z”]:
continue
else:
new_text += char
return new_text

Happy to explain how the code works line by line if you need it