reversing a string

 Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license()" for more information.

>>> name="Aamir"

>>> string[::,-1]

Traceback (most recent call last):

  File "<pyshell#1>", line 1, in <module>

    string[::,-1]

NameError: name 'string' is not defined

>>> string[::-1]

Traceback (most recent call last):

  File "<pyshell#2>", line 1, in <module>

    string[::-1]

NameError: name 'string' is not defined

>>> name[::]

'Aamir'

>>> name[::-1]

'rimaA'

>>> ##if step value is negative then it start from last upto begining.

Comments

Popular posts from this blog

XAMPP, SQL BASIC COMMANDS

The Minion Game Hackerrank Solution

Arrays - DS | HackerRank Solutions