Saturday, 24 March 2012

Swap two string in Python using third string


-def InputString():
    Str1=raw_input("Enter your first string")
    Str2=raw_input("Enter your second string")
    print("Befor swaping")
    print'string 1 is=>',Str1
    print'string 2is=>',Str2

    Temp=Str1
    Str1=Str2
    Str2=Temp
    print("\nAfter swapping")
    print 'string 1 is=>',Str1
    print 'string 2is=>',Str2

-def main():
    InputString()

main()

No comments:

Post a Comment

Compiler for C,C++ and Python {paste your programme to see the output}