Example #1
0
def main():
    """
	docstring
	"""
    print("Welcome to EZHealth \n \n Here are your options:")
    print("\
		\n 1. Look up a doctor by location \
		\n 2. Calculate your BMI \
		\n 3. Calculate the number of calories you should consume for your age and weight\
		\n 4. Access the recommended baby items checklist to be prepared for almost any situation \
		\n 5. Sleep Calculator \
		\n 6. Weight Based Divided Dose Calculator \
		\n 7. Forum")

    print("\n Type \"0\" to quit")

    mainMenuInput = int(
        input(
            "\n Please type the number of the option you'd like to explore: "))

    while int(mainMenuInput) != 0:
        if int(mainMenuInput) not in [1, 2, 3, 4, 5, 6, 7
                                      ]:  #error check if input is out of range
            mainMenuInput = input("Please type a number between 1 and 4: ")

        elif mainMenuInput == 1:  #call each separate method function
            pass

        elif mainMenuInput == 2:
            import bmi  #imports function, if you change the name here, change it catch_error also
            bmi.BMI()
            import catch_error
            catch_error.error(2)
            break

        elif mainMenuInput == 3:
            import calcounter_alt
            calcounter_alt.calorie_intake()
            import catch_error
            catch_error.error(3)
            break

        elif mainMenuInput == 4:
            pass

        elif mainMenuInput == 5:
            import sleepcal_alt
            sleepcal_alt.sleep()
            import catch_error
            catch_error.error(5)
            break

        elif mainMenuInput == 6:
            pass

        elif mainMenuInput == 7:
            pass
    return
Example #2
0
def error(x):
    """
    docstring
    """
    
    while True:
        if x == 1:
        repeat1 = input("Would you like to use this function again? (y/n)  ")
        if repeat1 == 'y':
            import doc_search
            doc_search.docs()
            repeat1 = input("Would you like to use this function again? (y/n)  ")
        elif repeat1 == 'n':
            break
        else:
            repeat1 = input("Please enter either \"y\" or \"n\".")
            break

    while True:
        if x == 2:
            repeat2 = input("Would you like to use this function again? (y/n)  ")
            if repeat2 == 'y':
                import bmi
                bmi.BMI()
                repeat2 = input("Would you like to use this function again? (y/n)  ")
            elif repeat2 == 'n':
                break
            else:
                repeat2 = input("Please enter either \"y\" or \"n\".")
        break

    while True:
        if x == 3:
            repeat3 = input("Would you like to use this function again? (y/n)  ")
            if repeat3 == 'y':
                import calcounter_alt
                calcounter_alt.calorie_intake()
                repeat3 = input("Would you like to use this function again? (y/n)  ")
            elif repeat3 == 'n':
                break
            else:
                repeat3 = input("Please enter either \"y\" or \"n\".")
        break

    while True:
        if x == 4:
            repeat3 = input("Would you like to use this function again? (y/n)  ")
            if repeat4 == 'y':
                import essentials
                essentials.checklist()
                repeat4 = input("Would you like to use this function again? (y/n)  ")
            elif repeat4 == 'n':
                break
            else:
                repeat4 = input("Please enter either \"y\" or \"n\".")

    while True:
        if x == 5:
            repeat5 = input("Would you like to use this function again? (y/n)  ")
            if repeat5 == 'y':
                import sleepcal_alt
                sleepcal_alt.sleep()
                repeat5 = input("Would you like to use this function again? (y/n)  ")
            elif repeat5 == 'n':
                break
            else:
                repeat5 = input("Please enter either \"y\" or \"n\".")
        break

    while True:
        if x == 6:
            pass

    while True:
        if x == 7:
            pass

    return
Example #3
0
def main():
    """
    This function displays the home page of the EZHealth application,
    which includes more specific instructions on how to access all the other functions
    within the package.
    Each function does something different; short descriptions are provided
    below and on the main.py homepage, and longer descriptions and instructions
    are printed when you choose to use (and thus run) those functions.
    This function also can account for user input error, and a
    large portion of the instructions are printed when a user runs this program.
    """

    print("Welcome to EZHealth \n \n We offer the following services:")
    print("\
        \n 1. Doctor lookup by location \
        \n 2. BMI calculator \
        \n 3. Healthy daily calorie intake calculator\
        \n 4. Recommended baby items checklist *Great for expecting/new parents!* \
        \n 5. Healthy daily sleep duration calculator")

    print("\n Type \"0\" to quit")

    mainMenuInput = (input(
        "\n Please type the number of the service you'd like to explore: "))

    while mainMenuInput != '0':
        if mainMenuInput.isdigit() == False:
            mainMenuInput = input("Please type a number from 1 to 5:  ")

        elif int(mainMenuInput) not in [1, 2, 3, 4, 5]:
            mainMenuInput = input("Please type a number from 1 to 5: ")

        elif int(mainMenuInput) == 1:
            import doc_search
            doc_search.docs()
            repeat1 = input(
                "Would you like to use this function again? (y/n):  ")
            while True:
                if repeat1 == 'y':
                    import doc_search
                    doc_search.docs()
                    repeat1 = input(
                        "Would you like to use this function again? (y/n):  ")
                elif repeat1 == 'n':
                    break
                else:
                    repeat1 = input("Please enter either \"y\" or \"n\":  ")
            break

        elif int(mainMenuInput) == 2:
            import bmi
            bmi.BMI()
            repeat2 = input(
                "Would you like to use this function again? (y/n):  ")
            while True:
                if repeat2 == 'y':
                    import bmi
                    bmi.BMI()
                    repeat2 = input(
                        "Would you like to use this function again? (y/n):  ")
                elif repeat2 == 'n':
                    break
                else:
                    repeat2 = input("Please enter either \"y\" or \"n\":  ")
            break

        elif int(mainMenuInput) == 3:
            import caltesting
            caltesting.calorie_intake()
            repeat3 = input(
                "Would you like to use this function again? (y/n):  ")
            while True:
                if repeat3 == 'y':
                    import caltesting
                    caltesting.calorie_intake()
                    repeat3 = input(
                        "Would you like to use this function again? (y/n):  ")
                elif repeat3 == 'n':
                    break
                else:
                    repeat3 = input("Please enter either \"y\" or \"n\":  ")
            break

        elif int(mainMenuInput) == 4:
            import essentials
            essentials.checklist()
            repeat4 = input(
                "Would you like to use this function again? (y/n):  ")
            while True:
                if repeat4 == 'y':
                    import essentials
                    essentials.checklist()
                    repeat4 = input(
                        "Would you like to use this function again? (y/n):  ")
                elif repeat4 == 'n':
                    break
                else:
                    repeat4 = input("Please enter either \"y\" or \"n\":  ")
            break

        elif int(mainMenuInput) == 5:
            import sleepcal_alt
            sleepcal_alt.sleep()
            repeat5 = input(
                "Would you like to use this function again? (y/n):  ")
            while True:
                if repeat5 == 'y':
                    import sleepcal_alt
                    sleepcal_alt.sleep()
                    repeat5 = input(
                        "Would you like to use this function again? (y/n):  ")
                elif repeat5 == 'n':
                    break
                else:
                    repeat5 = input("Please enter either \"y\" or \"n\":  ")
            break

        else:
            print('uhoh')
    return