Nov-07-2019, 03:02 PM
''' Write a program (using functions!) that asks the user for a long string containing multiple words. Print back to the user the same string, except with the words in backwards order. Sample My name is Camilla output: Camilla is name My -PSEUDOCODE- 1) Ask user a string 2) Get string and break it 3) Change the order of string 4) Union the string STRING ARE LISTS !!!! string = "example" for c in string: print "one letter: " + c ''' string_input = input("Insert a long phrase: ") #print(string_input) test if input is print split_string = string_input.split() #print(split_string) test if string become list for word_break in reversed(split_string): print( "".join(word_break))
Output:Insert a long phrase: My name is Camilla
Camilla
is
name
My
Hi,I would that these words are display in a single line but I tried to change my loop statement and never is changed.
Can you help me?