Skip to content

Instantly share code, notes, and snippets.

@JimDennis
Created December 4, 2022 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JimDennis/89582af43d13074141380ecfd17c7a58 to your computer and use it in GitHub Desktop.
Save JimDennis/89582af43d13074141380ecfd17c7a58 to your computer and use it in GitHub Desktop.
How to use gists for discussion of Python code
# Nostr posting: My first ever python script I wrote almost two years ago.
# This program will take user inputs and output the caloric intake required as stated in the insanity elite nutrition guide
print('Welcome to the Insanity Calorie calculaor \n');
# Step #1 Use the Harris Benedict Equation:
# First ask what the weight height, and age
print('Please answer each question \n')
weight = float(input("Please enter your weight in pounds: \n"))
age = float(input("Please enter your age in years: \n"))
height = float(input("Please enter your foot number of your height: \n")) * 12 + (float(input("Please enter your inches: \n")))
# next ask if they are a woman or a man
gender = str(input("Please enter w for woman or m for man: \n").lower())
# take all the above information and calculate the calories needed
if gender == "w":
calories = 655 + (4.35 * weight) + (4.7 * height) - (4.7 * age)
elif gender == "m":
calories = 66 + (6.23 * weight) + (12.7 * height) - (6.8 * age)
else:
print("please enter w or m ")
print("Based upon the Harris Benedict Equation your caloric intake is: ")
print(calories)
# Step 2 consideration for activity level
# now we must add a factor for level of activity
activity_level = str(input("What is your activity level? Sedntary, Lightly Active, Moderately Active, Very Active, Extremely Active: \n"))
if activity_level == "Sedentary":
calories = calories * 1.2
elif activity_level == "Lightly Active":
calroies = calories * 1.375
elif activity_level == "Moderately Active":
calories = calories * 1.55
elif activity_level == "Very Active":
calories = calories * 1.7
elif activity_level == "Extremely Active":
calories = calories * 1.9
print ("After activity level consideration your suggested caloric intake is: ")
print (calories)
# Step 3 Weight goals
goal = str(input("What is your weight loss goal? loss, maintain, gain: \n"))
if goal == 'loss':
calories = calories - 500
elif goal == 'maintain':
calories = calories + 0
elif goal == 'gain':
calories = calories + 300
print ("Your total caloric intake is: ")
print (calories)
print ("Thank you for using the Insanity Calorie Calculator good luck on your fitness journey :-)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment