Write a program that takes in a line of text as input, andoutputs that line of text in reverse. The program repeats, endingwhen the user enters "Done", "done", or "d" for the line oftext.
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
Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, en
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am