Reverse words

    0

    0

    Mahendra Kumar

    beginnerstringsreverse

    Python program to reverse words in a string sentence

    # 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)
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    Legal
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.