A vegan diet consists only of plant-based foods. It does not contain any animal products like meat, eggs, milk, honey, etc. A vegan lifestyle extrapolates this into not using day-to-day articles made up of animal products like leather, wool, silk, etc. A person observing this type of lifestyle is called a vegan.
Veganism has many health benefits. It also has multiple environmental benefits. According to multiple researches, a vegan person in a single month can save :Â Â
- 1100 gallons or 4164 litres of water
- 45 pounds or 20.4 kgs of grain
- 30 square feet or 2.7 square metre of forest
- 20 pounds or 9 kgs of carbon dioxide
Algorithm :Â
- Convert the years into months and add it to the months.
- Calculate the amount of items saved according the values mentioned above.
- Use round() method to round off the values, and then print them.
Â
Python3
# function to calculate the amount of# things saved by being vegandef vegan_calculator(m, y):Â
    # converting years to months    months_vegan = y * 12 + mÂ
    # calculating things saved    water = 4164 * months_vegan    grain = 20.4 * months_vegan    forest = 2.7 * months_vegan    co2 = 9 * months_veganÂ
    # printing the statistics    print("You have been vegan for " + str(months_vegan) + " months.")    print("\nYou have successfully saved :")    print(str(water) + " litres of water")    print(str(round(grain)) + " kgs of grain")    print(str(round(forest)) + " square metres of forest")    print(str(round(co2)) + " kgs of carbon dioxide")Â
# Driver codeif __name__=="__main__":Â Â Â Â months = 4Â Â Â Â years = 2Â Â Â Â vegan_calculator(months, years) |
Output :Â
You have been vegan for 28 months. You have successfully saved : 116592 litres of water 571 kgs of grain 76 square metres of forest 252 kgs of carbon dioxide
