Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Need help Please

+1 vote
asked Sep 26 by Braian Bacaro (230 points)
Write, debug, run a program that exchanges the first and last characters in a given string and returns the new string.

Sample Input:
"abcd"
"a"
"xy"
Sample output:
dbca
a
yx

2 Answers

+2 votes
answered Sep 26 by Admin (4,850 points)
Asking for solution of problem, without  any apparent effort is highly discouraged.
You should try to add more details on what effort did you put in to solve the problem and where do you feel stuck in solving problem.
+1 vote
answered Oct 1 by ITSME (740 points)

I am encouraging this type of questions without any effort but i did made the answer so you can use

b = ""
a = input("Enter the string:")

A = list(a)
b = A[-1]
A[-1] = A[0]
A[0] = b
for element in A:
    print(element, end = "")
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...