Tip = 15/100 different from tip = 0.15


#1

When I use "tip = 15/100" on 3. Tip
Codecademy says tip = 0 and not 0.15 as it should be, but if i use "tip = 0.15" I pass the session without any problem.

Is there an issue with my code or is this a bug from codecademy?



Replace this line with your code.


#2

In Python 2.x this will return an integer, namely, 0.

Try converting the outcome to a float.

float(15/100)

#3

If I use

tip = float(15/100)

I get the error message: "Oops, tente outra vez.
Parece que tip é 0.0 em vez de 0.15."

:-/


#4

We need a link to the lesson so we are in the exercise context, and everyone reading the same question/instructions. Please post a link. Thanks.

Nous avons besoin d'un lien vers la leçon que nous sommes dans le cadre de l'exercice, et tous ceux qui lisent les mêmes questions / instructions. S'il vous plaît poster un lien. Merci.


#5

Here it is:

https://www.codecademy.com/pt-BR/courses/python-beginner-pt-BR-w5wuy/0/3?curriculum_id=53594ed4fed2a85327000001


#6

We have to type exactly as given (expected).

tip = 0.15

#7

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