Doubts about the float and encoding error

Asked

Viewed 28 times

1

# coding: utf-8
peso = float(input('Qual o seu peso? (quilos)' ))
altura = float(input('Qual o seu tamanho? (metros)'))
imc = peso/altura**2
print('seu IMC é de', imc)

What is your weight? (kilos) 49.00

How big is it? (meters) 1.62

('its IMC xc3 xa9 de', 18.670934308794386)

  • Why these \xc3 xa9 are appearing in my reply?
  • How to reduce the decimal places of the float?
  • What version of Python are you using? How is the code running?

  • See if your file is saved with the utf8 encoding, it is common the file is not in utf8 and there are such bugs, try to open the file by sublime and click "File > Save with encoding > UTF-8".

  • To reduce the number of decimals, use round(imc,2) to two decimal places.

No answers

Browser other questions tagged

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