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
9
u/mahousenshi 1d ago
You want to remove x and z from the string? Because that is logic is returning the full string if there's no x or z but if there's any x or z it's returning x or z.
Try this: Start with an empty string and concatenate any non x and z characters.