Moving through a string

I know that I can write a string of multiple lines using the \n character. Is there any way with which I can move back to the previous line in the string? (like an opposite of the \n character)

I’m not sure if I understand… What would be a usage for something like this?

The \n character represents a new line. However the idea of “moving back to a previous line” isn’t a character, it would be something your code does to the string itself. You can “build up” the string accordingly, but looking to edit a string would add unnecessary complexity, which can be done, but shouldn’t be the goal if your the one building the string.

2021-09-26

I am solving the freecodecamp project of arithmetic arranger in the python scientific programming module: and I first started by reconstructing each problem arranging it vertically to build up the wanted string of problems which are supposed to be arranged side by side and I thought in the beginning I could for-loop through them to concatenate them the right way presented and I’ve done all code based on that assumption, but I realized when done with a problem and wanted to concatenate it with the second problem,
I would need to get back to the first line. And because I did not want to fork my code to cope this fact (constructing each line by itself and then concatenating), I wondered if there was something like the \n character that could save me some time.

here your answer on what you need to do

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.