I'm sure we've all been through a phase where we were interested in what words would sound like backwards, or how to spell them backwards. With software like Audacity, you can record yourself saying things and play them backwards to see. In this assignment you'll use the Python string manipulation functions to reverse a word. If you missed the first assignment, click here for instructions on how to install Python. If you are unable to install Python then you can use Repl.it to run your programs on-line.
Here is a reminder of the commands you might need for this assignment.
print() - text needs to be put in speech marks, e.g. print("Hello"), numbers and variables don't, e.g. print(10) or print(A). You can use the + symbol to concatenate (join) text, but remember that Python is typed, so you will need to cast numbers to combine them with text - e.g print("My age is "+str(21)).
input() - e.g. age = input("How old are you? ") will ask the user for a number and store the answer in the variable called age. Note that the result will be stored as a string unless you cast it to an integer using int().
len() - returns the number of characters in a string , e.g. len("Hello") returns the value 5.
string - you can pick characters out of a string based on their position, e.g. "programming"[2:4] will return og (Python starts counting at 0, so 2 is the third letter, and it includes all of the letters up to, but not including, the second position).
Your task is to produce a program to reverse words entered by the user. Your program should:
ask the user for a word
reverse the word and print the result
be clear and easy to use
The minimum output is the reversed word, but you can add extra text to make your program easier to understand. You could capitalise the first letter, or if you fancy a challenge, you could
test whether a word was a palindrome or try to create an anagram instead!