bowl-spoonWorked-out Examples

  1. Write a python program to reverse a string and check if it is a palindrome.

def reverse_string(input_str):
    """Reverses the input string."""
    return input_str[::-1]

def is_palindrome(input_str):
    """Checks if the input string is a palindrome."""
    reversed_str = reverse_string(input_str)
    return input_str.lower() == reversed_str.lower()

def main():
    input_str = input("Enter a string: ")
    reversed_str = reverse_string(input_str)
    
    print(f"Original String: {input_str}")
    print(f"Reversed String: {reversed_str}")
    
    if is_palindrome(input_str):
        print(f"'{input_str}' is a palindrome.")
    else:
        print(f"'{input_str}' is not a palindrome.")

if __name__ == "__main__":
    main()

  1. Write a python program to generate Lucas Series

  1. Generate a Lucas Series using a Recursive Function

  1. How do I calculate Taxation using Python considering both Indian Old Regime Tax Slab and New Regime Tax Slab

  1. Using Dictionaries read Name and Date of Birth as input and compute the age of all the people as of the program execution date.

  1. Compute SGPA by reading marks of 6 subjects in a given semester

  1. A Sample script to illustrate Tuples in Python

  1. Read two sets of 30 random student roll numbers and store them in a SET. Print the UNION, INTERSECTION, DIFFERENCE, SYMMETRIC DIFFERENCE

Last updated