-6

In Python: How do I write a function that would remove "x" number of characters from the beginning of a string?

For instance if my string was "gorilla" and I want to be able remove two letters it would then return "rilla".

OR if my string was "table" and I wanted to remove the first three letters it would return "le".

Please help and thank you everyone!

user2864740
  • 60,010
  • 15
  • 145
  • 220
rod921
  • 7
  • 2

1 Answers1

1

You can use this syntax called slices

s = 'gorilla'
s[2:]

will return

'rilla'

see also Explain Python's slice notation

Community
  • 1
  • 1
Dmitry Loparev
  • 462
  • 2
  • 9