DEV Community

Cover image for To Reverse a string with out using for loop in python. | DAY 1
Jagannath Ghantenavar
Jagannath Ghantenavar

Posted on

To Reverse a string with out using for loop in python. | DAY 1

a = 'Dev.to'
a[::-1]

Explanation :

[start index : end index : step parameter ]

  • The first colon : indicates the start index (default is the beginning of the sequence).
  • The second colon : indicates the end index (default is the end of the sequence).
  • The third colon : indicates the step parameter, which means the sequence should be traversed in steps of -1 (i.e., in reverse)..

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay