Given a text file. The task is to reverse a single line of user’s choice from a given text file and update the already existing file.
Input: Hello Geeks for geeks! User choice = 1 Output: Hello Geeks geeks! for Input: This is a geek Welcome to GeeksforGeeks GeeksforGeeks is a computer science portal User choice = 0 Output: geek a is This Welcome to GeeksforGeeks GeeksforGeeks is a computer science portal
Let’s suppose the text file looks like this –
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.