Sunday, December 22, 2024

Gammon => Ham Calculator V1.0

def ham_cooking_time(grams):
    """
    Calculates the cooking time for a ham based on its weight.

    Args:
        grams: The weight of the ham in grams.

    Returns:
        A tuple containing:
            - Boiling time in minutes.
            - Oven cooking time in minutes.
    """

    # Calculate base cooking time (20 minutes per 450 grams)
    base_time = grams / 450 * 20

    # Add 20 minutes to the base time
    total_time = base_time + 20

    # Determine boiling and oven cooking times (approximately 1/2)
    boiling_time = int(total_time * 0.5)
    oven_time = int(total_time * 0.5)

    return boiling_time, oven_time

def glazing_time(grams):
    """
    Calculates the glazing time for a ham based on its weight.

    Args:
        grams: The weight of the ham in grams.

    Returns:
        The glazing time in minutes.
    """

    # Calculate base cooking time (20 minutes per 450 grams)
    base_time = grams / 450 * 20

    # Add 20 minutes to the base time
    total_time = base_time + 20

    # Calculate glazing time (subtract 20 minutes from the halfway point)
    return int(total_time * 0.5 - 20)

# Get ham weight from user
ham_weight = float(input("Enter the weight of the ham in grams: "))

# Calculate cooking times
boiling_time, oven_time = ham_cooking_time(ham_weight)

# Calculate glazing time
glaze_time = glazing_time(ham_weight)

# Print cooking times
print(f"Boiling time: {boiling_time} minutes")
print(f"Oven cooking time at Gas Mark 4: {oven_time} minutes")
print(f"Glaze at: {glaze_time} minutes")

print("MERRY CHRISTMAS!")

No comments:

Post a Comment

Gammon => Ham Calculator V1.0

def ham_cooking_time (grams): """ Calculates the cooking time for a ham based on its weight. Args: g...