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 to give a string and remove characters from a string starting from zero up to n and return a new string

+8 votes
asked Jul 30, 2021 by Mysteryplayz (270 points)

1 Answer

0 votes
answered Aug 2, 2021 by Peter Minarik (89,040 points)

Please, read about slicing in Python: https://www.w3schools.com/python/python_strings_slicing.asp

Here's the code:

text = input('text = ')
n = int(input('n = '))
newText = text[n:]
print('text after position n = ' + newText)
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.