Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class String(str):
- def reverse(self):
- self = self[::-1] #reverses the string
- print self #prints 'DCBA'
- s = String('ABCD')
- s.reverse()
- print s #prints 'ABCD'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement