Why does it have to be 15.0/100?


#1


https://www.codecademy.com/courses/python-beginner-GB6hM/0/3?curriculum_id=4f89dab3d788890003000096

I'm not stuck but I tried to get the 15% into a percentage form and when I typed 15/100 it didn't work. I was just wondering why I needed to include the .0 at the end.


# You're almost there! Assign the tip variable on line 5.

meal = 44.50
tax = 0.0675
tip = 15.0/100


#2

because in python2, dividing two integers gives a integer as result. so 15 / 100 would simply be zero, because the number is floored

dividing a float and a integers gives an float as result.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.