Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How do I delete letters after I write them to make room for the next sentence?

+1 vote
asked Dec 30, 2020 by Simon Kupfer (130 points) 1 flag
I want to write something, for instance:


Then, I want to erase it to make room for a new word/phrase/sentence, such as:


How can I do this?

1 Answer

0 votes
answered Jan 4 by Peter Minarik (15,580 points)
edited Jan 12 by Peter Minarik

The typical solution is not to delete your previous lines, but print the instruction in the next line and read from there so the user can see the (input/output) message history on the screen.


If you really want to do what you just asked, you can clear the screen and then print to the empty screen again.

Have a look at this: https://www.geeksforgeeks.org/clear-screen-python/ (I'm assuming you're doing Python.)

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.