Slicing

text = 'HelloWorld!'
n = 6
result = text[-n:]

print(result)  # World!

Leave a Comment

Your email address will not be published. Required fields are marked *