Python 3 not returning float

Asked

Viewed 61 times

-1

I started to study python 3 and I was doing some exercises, until I came across something unexpected, I can’t receive a float as a response. I followed everything that was in the exercise and yet I get an integer.inserir a descrição da imagem aqui

  • 6

    Avoid putting pictures, put the code in the question.

  • 1

    Rather than %i use %f

  • 1

    Vlw for the help man.

2 answers

2


I noticed you put "%i" on lines 12 and 16, this is not to show integer value.

  • That was the problem. VLW for help!

1

On the lines where the 'prints' result simply change the encoding to:

 print("Media %f"%media)

This formatting will allow you to display the content in Float

in that link you can also check other functions that are used in the same way!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.