In Python, write a program that takes in a lineof text as input, and outputs that line of text in reverse. Theprogram repeats, ending when the user enters "Done", "done", or "d"for the line of text.
Ex: If the input is:
Hello there
Hey
done
then the output is:
ereht olleH
yeH
Additional tips:
• Use nested loops
• The outside while loop deal with the strings "Done", "done",or "d"
• The inside for loop will iterate through character bycharacter for any other string
• Incorporate the range() function into your for loop to gobackwards character by character
• The starting value of your range should be len()-1
• Build your output string by concatenating the next letter witheach iteration of the for loop
In Python, write a program that takes in a line of text as input, and outputs that line of text in reverse. The program
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am