ASSIGNMENT
Q.16
Q.16.Write a menu-driven Python program to converts a string into: Uppercase Lowercase Title Case Capitalized Swap Case
# Menu-driven program for string case conversion text = input("Enter a string: ") while True: print("\n========== STRING CASE MENU ==========") print("1. Convert to Uppercase") print("2. Convert to Lowercase") print("3. Convert to Title Case") print("4. Convert to Capitalized") print("5. Convert to Swap Case") print("6. Exit") print("======================================") choice = int(input("Enter your choice: ")) if choice == 1: print("Uppercase:", text.upper()) elif choice == 2: print("Lowercase:", text.lower()) elif choice == 3: print("Title Case:", text.title()) elif choice == 4: print("Capitalized:", text.capitalize()) elif choice == 5: print("Swap Case:", text.swapcase()) elif choice == 6: print("Program terminated.") break else: print("Invalid choice. Please try again.")


