[Tutor] Help me to print this formatted output

Abhishek Yadav abhjop at gmail.com
Tue Sep 6 08:18:26 EDT 2022


celsius = float(input('Enter temperature in celsius: '))

# Converting
fahrenheit = 1.8 * celsius + 32
kelvin = 273.15 + celsius
gap = " "*3
# Displaying output
print(f"{'Celsius':7s}{gap}{'Fahrenheit':10s}{gap}{'Kelvin':6s}")
print(f"{celsius:7.0f}{gap}{fahrenheit:10.1f}{gap}{kelvin:6.2f}")


out put  : --

Enter temperature in celsius: 10
Celsius   Fahrenheit   Kelvin
        10              50.0  283.15

On Tue, 6 Sept 2022 at 17:42, Abhishek Yadav <abhjop at gmail.com> wrote:

>
>


More information about the Tutor mailing list