python program to Reverse words in a given String in Python example str = "Capgemini" output should be reverse of that string li

Answer plz

13th Feb 2021, 10:38 AM
Suresh Suresh
Suresh Suresh - avatar
3 Answers
+ 3
string = "Hello" string = string[::-1] Output: olleH --> string[start:end:steps] Here we did not specify the 'start' and 'end' and these will be 0 and last element of the string by default, respectively. -1 in steps means backward Visit this link to learn more: https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/python_howto_reverse_string.asp If you ever have questions about short codes like this, you can always use the search bar in code playground and google.
13th Feb 2021, 10:49 AM
noteve - avatar
+ 3
str[::-1] , you should read about slicing in python. Also please make sure to use search bar before asking a question, many times such questions have been answered already.
13th Feb 2021, 10:50 AM
Abhay - avatar
- 1
Bro this answer not showing any where in search bar
13th Feb 2021, 10:52 AM
Suresh Suresh
Suresh Suresh - avatar