Can clean it up and give some tips.
Just
See that indentation is
Look at this link Python 3's f-strings,it give code more cleaner look,
and as new(or old) Python user
def cel_to_fah(celcius): fahrenheit = (celcius * 9/5) + 32 return fahrenheit def fah_to_cel(fahrenheit): celcius = (fahrenheit - 32) * 5/9 return celcius if __name__ == '__main__': cel = float(input('Enter the temperature in celcius: ')) print(f'The temperature in Fahrenheit: {cel_to_fah(cel:.2f)}') fah = float(input('Enter the temperature in fahrenheit: ')) print(f'The temperature in celcius: {fah_to_cel(fah):.2f}')
Output:Enter the temperature in celcius: 0
The temperature in Fahrenheit: 32.00
Enter the temperature in fahrenheit: 32
The temperature in celcius: 0.00
Just
return
from functions as you us print()
with explanation later.See that indentation is
4-space
and no CamelCase in Python,look at PEP-8Look at this link Python 3's f-strings,it give code more cleaner look,
and as new(or old) Python user
f-string
is what should be used.>>> for word in 'f-strings are awesome'.split(): ... print(f'{word.upper():~^20}') ~~~~~F-STRINGS~~~~~~ ~~~~~~~~ARE~~~~~~~~~ ~~~~~~AWESOME~~~~~~~