String Programs in Python
1. Write a program to reverse a string. def reverse_string(s): return s[::-1] string = "hello" print(reverse_string(string)) 2. Write a program to check if a string is a palindrome. def is_palindrome(s): return s == s[::-1] string = "madam" print(is_palindrome(string)) 3.Write a program to count the number of vowels and consonants in a string. def count_vowels_consonants(s): vowels = "aeiouAEIOU" v_count = c_count = 0 for char in s: if char.isalpha(): if char in vowels: v_count += 1 else: c_count += 1 ...