# take inputs
      string = 'Know Program'
      # splitting the string into list of words
      words = string.split(' ')
      # reversing the split string list and join using space
      reverseString = " ".join(reversed(words))
      # print reverse of each word in a string
      print('The reverse is', reverseString)
      
      Python language logo

      Reverse words

      beginner
      strings
      reverse

      Python program to reverse words in a string sentence

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.