Computer Science, asked by Rishita1111, 1 year ago

write a program to accept a string. Display the string in reverse order.
Input: Computer is fun.
Output: Fun is computer.

Answers

Answered by jai696
10

\large\mathsf\color{pink}{Solution\: using\: python\: 3}

s = input("enter string: ").split()

reversed_s = s[::-1]

first_word_arr = list(reversed_s[0])

del first_word_arr[-1]

first_word_arr[0] = first_word_arr[0].upper()

last_word_arr = list(reversed_s[-1])

last_word_arr[0] = last_word_arr[0].lower()

last_word_arr.append(".")

new_s_arr = [

"".join(first_word_arr),

"".join(reversed_s[1]),

"".join(last_word_arr)

]

print(" ".join(new_s_arr))

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions