Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Done", "done", or "d" for the line of text

Respuesta :

The program that takes in a line of text as input, and outputs that line of text in reverse is as follows:

list1 = []

x = input("input your text for it to be reverse: ")

while x != "done" and "d" and "Done":

    list1.append(x)

    x = input("input your text for it to be reverse: ")

   

for i in list1:

    print(i[::-1])

Code explanation:

The code is written in python

  • The first line of code, a variable is declared with an empty list.
  • The variable x is used to store the users input
  • Then we use the while loop to check if the users input is any of "Done", "d" and "done."
  • If the users input is not any of "Done", "d" and "done", we append it to the empty list
  • We loop through the list using a for loop to get the individual elements and finally print the reverse of each elements.

learn more on python code here; https://brainly.com/question/24833629

ACCESS MORE
EDU ACCESS