Python program to check selected year is leap year or not

    
        def is_leap_year(year):
            # Leap year if divisible by 4
            if year % 4 == 0:
                # If divisible by 100, it must also be divisible by 400
                if year % 100 == 0:
                    return year % 400 == 0
                return True
            return False

        # Get user input
        user_input = input("Enter a year: ")

        # Check if the input is a valid integer
        try:
            year = int(user_input)
            if year > 0:
                # Check if it's a leap year
                if is_leap_year(year):
                    print(f"{year} is a leap year.")
                else:
                    print(f"{year} is not a leap year.")
            else:
                print("Please enter a valid positive year.")
        except ValueError:
            print("Please enter a valid integer.")
    
Output 1:
    
        Enter a year: 1992
        1992 is a leap year.
    
Output 2:
    
        Enter a year: 2023
        2023 is not a leap year.