Join the Codozzle community now and ask questions, share knowledge, and connect with peers and industry leaders!
Log in to keep sharpening those coding skills.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
How to reverse a given word “PYTHON” in python language without using reverse function?
Hi Shanmathi, You can use slicing in python which can reverse the given string. Syntax : variable[start,stop,step] Explanation: Here "start" and "stop" denote the starting and ending index of the string. If they are not mentioned, then it takes the default values as 0 (zero) and length of the stringRead more
Hi Shanmathi,
You can use slicing in python which can reverse the given string.
Syntax : variable[start,stop,step]
Explanation: Here “start” and “stop” denote the starting and ending index of the string. If they are not mentioned, then it takes the default values as 0 (zero) and length of the string respectively. Here comes the main parameter “step” which gives you the answer. “Step” defines the offset distance. If the value is negative then it starts from “stop” value and ends at “start” value.
Example :
name = “PYTHON”
print(name[::-1])
OUTPUT: NOHTYP
See less