Your conversion functions have two notable things:
You're printing the result directly. Don't do this. For toy programs like this, this is ok. In the real world though, you don't just print data to the screen, you use data. With how you have it now, the caller can't actually use the converted value for anything.
You're putting an empty
returnat the end. This is redundant though and unnecessary.
I would have the functions return the converted value, and print it at the call site:
def value_input(selection):
value = input('''\nPlease enter the temperature you
want to convert: ''')
try:
value = float(value)
except ValueError:
print('That is not a number!\n')
else:
is_celsius = selection == 'c' # Save if we're converting to Celsius or not
new_value = convert_c2f(value) if is_celsius else convert_f2c(value)
unit_str = "C" if is_celsius else "F"
print(f'The answer is: {new_value}°{unit_str}')
def convert_c2f(value):
return (value * (9 / 5)) + 32
def convert_f2c(value):
return (value - 32) * (5 / 9)
I decided to reduce the printing down to a single call to print and just decide what data will be printed ahead of time. This is personal style though. Do whatever you feel is more readable.
The is_celcius checks could be condensed using tuples too. I'll show how that can be done when I get on my computer. I don't want to lose the draft on my phone.