-2

I'm trying to make a program in Python 3 (IDLE) which lets the user input a quote and outputs it in upper case, lower case and in reverse. I've tried this:

quote = input("Enter your quote here: ")
print(quote.upper())
print(quote.lower())
print(quote.reverse())

...but all I get back when I test it is this error text:

Enter your quote here: You are always unique.

Traceback (most recent call last):
  File "C:\Users\shobha m nair\Documents\Quote Conversion.py", line 2, in <module>
    quote = input("Enter your quote here: ")
  File "<string>", line 1
    You are always unique.
          ^
SyntaxError: invalid syntax

2 Answers2

0

You are probably using Python 2.x that's why you got the unexpected behaviour. The following code ran fine with Python 3.5:

quote = input("Enter your quote here: ")
print(quote.upper())
print(quote.lower())
print(quote[::-1])

There is no "reverse" method for strings.

masnun
  • 11,635
  • 4
  • 39
  • 50
0

This works for me:

quote = input("Enter your quote here: ") print(quote.upper()) print(quote.lower()) print(quote[::-1])

The last one is the extended splice operator. AFAIK there's no reverse method in Python 3.

Warrshrike
  • 126
  • 1
  • 8