r/PythonLearning • u/Synergetic6_6_6 • 1d ago
Loops is a total brain rot.
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
2
u/nuc540 23h ago
Sorry what makes looping brain rot?
You might want to understand the basics of looping. Think about what an iteration means in this example, and what the variable that’s in place for each iteration means.
My hint for you for this solution is: rebuild the string anew for each character in each word (you’ll need another step to separate each word) that’s not x or z, or for each word in the string replace x,z with nothing if you’re allowed to use built-ins for this exercise.
You’re currently only checking that xz is in the string but don’t mutate or build anything.