Untitled

mail@pastecode.io avatar
unknown
plain_text
10 days ago
1.1 kB
2
Indexable
Never
print("Menu")
print("1.String Concatenation")
print("2.String Length")
print("3.String Uppercase")
print("4.String Lowercase")
print("5.String Indexing")
print("6.String Slicing")
print("7.Exit")
while True:
 i=int(input("Enter Your Choice:"))
 if i==1:
 s1=input("Enter first String:")
 s2=input("Enter second String:")
 print("Concatenated String is:",s1+s2)
 elif i==2:
 s1=input("Enter String to find its length:")
 print("length of String is:",len(s1))
 elif i==3:
 s1=input("Enter string in lowercase:")
 print("Uppercase String is:",s1.upper())
 elif i==4:
 s1=input("Enter String in Uppercase:")
 print("lowercase String is:",s1.lower())
 elif i==5:
 s1=input("Enter String for Indexing:")
 pos=int(input("Enter the position to extract:"))
 print("character at position",pos,"is:",s1[pos])
 elif i==6:
 s1=input("Enter String for Slicing:")
 start=int(input("Enter the start position to extract:"))
 end=int(input("Enter the end position to extract:"))
 print("Sliced String is:",s1[start:end])
 elif i==7:
 break
 else:
 print("Invalid Input")
Leave a Comment