|
pearcalorieconverter.rb |
|
# Written by Acheev Bhagat #Python vs. Ruby #Ruby section of function comparison 1 #Calculates the calories per pounds of a pear #Lines of code(without comments)=7 #Lines of code(including all comments)=13 def calorie() cal_pound=27 puts "Enter the weight of your pear(in pounds): " weight=gets calories_pear=cal_pound * weight puts "Your pear contains about" + calories_pear + "calories." end |
| Just something I wrote when I was bored. Tells you you how many calories you consumed based on how many pears you ate. Compare it to the python file. |