@dk.mix
You can try this code also. This is also a conditional structure. In this case you can enter any temperature for conversion. (F/C).
Write a Python program to convert temperatures to and from celsius, fahrenheit.
c = (5/9) * (F-32);
f = (9/5)*C (+32);
temp = input('Enter the temperature you wants to convert : ')
degree = float(temp[:-1])
i_convention = temp[-1]
if i_convention.upper() == 'C':
result = float((9*degree)/5 + 32)
o_convention = "Fahrenheit"
elif i_convention.upper() == "F":
result = float((degree-32)*5/9)
o_convention = "Celsius"
else:
print('Enter the temperature with proper convention; F / C')
quit()
print("The temperature in ", o_convention, "is", result, "degrees")