I'm trying to call a function within a function that asks for some input. It runs and gives me the right answer, but not before showing "None".
def func1(f_temp):
c_temp = round(float((f_temp - 32) * 5 / 9),1)
print(f_temp, "degrees Fahrenheit is equal to", c_temp, "degrees Celsius.")
def func2(mph):
mps = mph * 0.44704
print(mph, "miles per hour is equal to", mps, "meters per second.")
def main():
print("Enter 1 to convert Fahrenheit temperature to Celsius.")
print("Enter 2 to convert speed from miles per hour to meters per second.")
main_input = int(input())
if main_input == 1:
f_temp = input(print("Please enter a temperature in Fahrenheit: "))
return func1(f_temp)
elif main_input == 2:
mph = input(print("Please enter a speed in miles per hour: "))
return func2(mph)
else:
print("Please enter 1 or 2 only.")
And here is what happens when I run it:
main()
Enter 1 to convert Fahrenheit temperature to Celsius.
Enter 2 to convert speed from miles per hour to meters per second.
1
Please enter a temperature in Fahrenheit:
None52
52.0 degrees Fahrenheit is equal to 11.1 degrees Celsius.