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.
# function to calculate the amount of # things saved by being vegan def vegan_calculator(m, y): # coverting 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 code if __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
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.