String Manipulation Program
Source Code
print("\n\n ***** STRING MANIPULATION OPERATION *****\n\n")
ustring = input("\n Enter Your String = ")
print("\n 1. Length \n 2. Capitalize \n 3. Upper \n 4. Lower \n 5. Swapcase \n 6. Lstrip \n 7. Rstrip \n 8. Strip \n 9. Isalnum \n 10. Isalpha \n 11. Isdigit \n 12. Append \n ")
choice=int(input("\n Enter Your Choice = "))
if choice==1:
result = len(ustring)
print("\n Length Of String Is = ",result)
elif choice==2:
result = ustring.capitalize()
print("\n After Capitalize = ",result)
elif choice==3:
result = ustring.upper()
print("\n UpperCase is = ",result)
elif choice==4:
result = ustring.lower()
print("\n Lowercase is = ",result)
elif choice==5:
result = ustring.swapcase()
print("\n Swappingcase Result is = ",result)
elif choice==6:
result = ustring.lstrip()
print("\n After leftstrip = ",result)
elif choice==7:
result = ustring.rstrip()
print("\n After rightstrip = ",result)
elif choice==8:
result = ustring.strip()
print("\n After strip = ",result)
elif choice==9:
result = ustring.isalnum()
print("\n Alphanumeric Result = ",result)
elif choice==10:
result = ustring.isalpha()
print("\n Alphabetic Result is = ",result)
elif choice==11:
result = ustring.isdigit()
print("\n Digit Result Is = ",result)
elif choice==12:
str2 = input("\n Enter Second String = ")
result = ustring + str2
print("\n After append string is = ",result)
Output:
'
Comments
Post a Comment