# Write a program that asks the user for 
# a long string containing multiple words.
# Print back to the user the same string, 
# with the words in backwards order.

def inputstring():
    testing = input("Enter a string: ")
    a = len(testing)
    printwordsback(a, testing)

def printwordsback(a, testing):
    if a > 1:
        set2 = [testing[i] for i in range(len(testing))]
        for i in range(len(set2)):
            set1 = set2[::-1]
            print(' '.join(set1))


Lessons Learned:

  1. How to split the string into individual characters.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s