Excuse the noob – cutting float input result to 1 decimal place /u/KazzJen Python Education

Hi, I’m a total beginner so excuse my ignorance.

I wrote a program to convert Celsius to Farenheit. It works well for most temperature inputs except eg ’21’ where it returns a value to 14 decimal places where ideally I’d like it to be just one.

How do I format the output, please?

celsius = input(“What is the temperature in Celsius: “)

farenheit = float(celsius)*1.8+32

print(f”The temperature in Farenheit is: {farenheit}”)

Thanks in advance.

submitted by /u/KazzJen
[link] [comments]

​r/learnpython Hi, I’m a total beginner so excuse my ignorance. I wrote a program to convert Celsius to Farenheit. It works well for most temperature inputs except eg ’21’ where it returns a value to 14 decimal places where ideally I’d like it to be just one. How do I format the output, please? celsius = input(“What is the temperature in Celsius: “) farenheit = float(celsius)*1.8+32 print(f”The temperature in Farenheit is: {farenheit}”) Thanks in advance. submitted by /u/KazzJen [link] [comments] 

Hi, I’m a total beginner so excuse my ignorance.

I wrote a program to convert Celsius to Farenheit. It works well for most temperature inputs except eg ’21’ where it returns a value to 14 decimal places where ideally I’d like it to be just one.

How do I format the output, please?

celsius = input(“What is the temperature in Celsius: “)

farenheit = float(celsius)*1.8+32

print(f”The temperature in Farenheit is: {farenheit}”)

Thanks in advance.

submitted by /u/KazzJen
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *