I have an issue I have been trying to overcome for sometime. Firstly, here is my code:
quote = input("Enter a Sentence: ")
a = len(quote)
counter = 0
counter1 = 0
reverse = len(quote)-1
print("The Length of the sentence is",a,"characters long!")
for x in range(0,a):
if str.isspace(quote[x]) == True:
counter = counter + 1
print("The Length of the sentence is",a - counter,"characters long (excluding space...)!")
for x in range(0,a):
if str.isupper(quote[x]) == True:
counter1 = counter1 + 1
print("The number of Upper Case Characters in the sentence is",counter1,"characters!")
print("The number of Lower Case Characters in the sentence is",a-counter1,"characters long!")
print("The Upper Case Version:")
print(str.upper(quote[0:a]))
print("The Lower Case Version:")
print(str.lower(quote[0:a]))
print("In Reverse order:")
while reverse >= 0:
print(quote[reverse])
reverse = reverse - 1
This program has been designed to find everything there is about a particular sentence. But if you look at the While loop at the bottom. It works fine, but prints the inverse of the sentence one character under another. Is there a way of putting it all in one line?