Deployment help interactive Python script

Help managing first depolyment - interactive Python to calculate, asks for user input to adjust a calcium dose and convert to elemental calcium:

Attempted to deploy - runs fine in console view. Not sure why I cannot push the script to a site so that I can share the calculator with another person to utilize.

I have limited programming experience but chose this platform as it is supposed to be easy to deploy an interactive Python script (as opposed to a static site)

Any help is appreciated - see attached image for error message (attempted to run x3, also tried using Python Beta template but unable to finish final step to deploy)


Screenshots, links, or other helpful context:

code snippet

python script below:

def get_calcium_type():
    while True:
        calcium_type = input("Enter the type of calcium supplement (carbonate): ").lower()
        if calcium_type in ["carbonate", "elemental"]:
            return calcium_type
            print("Invalid input. Please enter 'carbonate' or 'elemental'.")

def get_amount():
    while True:
            amount = float(input("Enter the amount of calcium (in mg): "))
            return amount
        except ValueError:
            print("Invalid input. Please enter a numeric value.")

def get_daily_dose_frequency():
    while True:
            frequency = int(input("How many times a day is the calcium carbonate given? "))
            return frequency
        except ValueError:
            print("Invalid input. Please enter a numeric value.")

def calculate_total_daily_dose(amount, frequency):
    return amount * frequency

def convert_to_elemental(calcium_type, total_daily_amount):
    if calcium_type == "carbonate":
        return total_daily_amount * 0.4
    return total_daily_amount

def get_patient_weight():
    while True:
            weight = float(input("Enter the patient's weight (in kg): "))
            return weight
        except ValueError:
            print("Invalid input. Please enter a numeric value.")

def get_dose_adjustment():
    while True:
        adjustment = input("Do you need to decrease the dose? (yes/no): ").lower()
        if adjustment in ["yes", "no"]:
            return adjustment == "yes"
            print("Invalid input. Please enter 'yes' or 'no'.")

def calculate_adjusted_dose(dose, adjustment_needed):
    if adjustment_needed:
        while True:
                reduction_percentage = float(input("Enter the reduction percentage (e.g., 25 for 25%): "))
                return dose * (1 - reduction_percentage / 100)
            except ValueError:
                print("Invalid input. Please enter a numeric value.")
    return dose

def convert_back_to_carbonate(elemental_dose):
    return elemental_dose / 0.4

def get_rounding_preference():
    preference = input("Do you want to round to a convenient number for easier administration? (yes/no): ").lower()
    return preference == "yes"

def round_dose(dose):
    # Example rounding to nearest 100 mg (for 100 mg/mL oral suspension)
    rounded_dose = round(dose / 100) * 100
    return rounded_dose

def main():
    calcium_type = get_calcium_type()
    amount = get_amount()

    daily_frequency = get_daily_dose_frequency()
    total_daily_dose = calculate_total_daily_dose(amount, daily_frequency)
    elemental_calcium = convert_to_elemental(calcium_type, total_daily_dose)
    patient_weight = get_patient_weight()

    print("\nTotal daily dose of calcium carbonate: {:.2f} mg".format(total_daily_dose))
    print("Total elemental calcium equivalent per day: {:.2f} mg".format(elemental_calcium))

    elemental_calcium_per_kg = elemental_calcium / patient_weight
    print("\nElemental calcium dose: {:.2f} mg/kg/day\n".format(elemental_calcium_per_kg))

    original_dose = total_daily_dose

    if get_dose_adjustment():
        elemental_calcium = calculate_adjusted_dose(elemental_calcium, True)
        print("\nAdjusted elemental calcium dose: {:.2f} mg".format(elemental_calcium))

        adjusted_elemental_calcium_per_kg = elemental_calcium / patient_weight
        print("Adjusted Total elemental calcium in mg/kg/day: {:.2f}\n".format(adjusted_elemental_calcium_per_kg))

        if calcium_type == "carbonate":
            updated_total_daily_dose = convert_back_to_carbonate(elemental_calcium)
            print("Updated Total Daily dose of calcium carbonate: {:.2f} mg".format(updated_total_daily_dose))

            new_lower_dose_per_administration = updated_total_daily_dose / daily_frequency
            print("\nNew lower dose of calcium carbonate (assuming administration {} times per day): {:.2f} mg\n".format(daily_frequency, new_lower_dose_per_administration))

            original_dose = new_lower_dose_per_administration

    if get_rounding_preference():
        rounded_dose = round(original_dose / 5) * 5
        dose_change_percentage = abs((rounded_dose - amount) / amount) * 100  # Using absolute value

        # Calculate the new dose based on the percentage change
        proposed_elemental_calcium_per_kg = elemental_calcium_per_kg * (1 - dose_change_percentage / 100)
        print("\nFor ease of administration, would {} mg work? (This is a dose change of {:.1f}%, which gives a total daily dose of {:.2f} mg/kg/day of Elemental calcium)\n".format(rounded_dose, -dose_change_percentage, proposed_elemental_calcium_per_kg))

        user_confirmation = input("Accept rounded dose? (yes/no): ").lower()
        final_dose = rounded_dose if user_confirmation == "yes" else original_dose
        print("\nFinal dose of calcium carbonate: {} mg".format(final_dose))

if __name__ == "__main__":

Hey @clearercontext0!

This isn’t a script you should deploy, you should just share it with people to fork and run.