i have an exercise that asks me to build a temperature converter. i need to ask a user what temperature he needs to convert then by the last letter c or f i will convert the temperature.
we didnt learn yet how to use def: , i was asked to use only if and elif statements. this is one of the things i tried but nothing seems to work for me:
temp = (input('enter a temperature you would like to convert: ')
if temp[-1] == 'c':
print(float(temp -32)/ 1.8) + 'f'
elif temp[-1] == 'f':
print(float(temp * 1.8) + 32) + 'c'