How do you write with the try the except statement rewrite the temperature conversion!
# TempConvert. Py
Val=input (" please input temperature for symbolic value (for example: 32 c) : ")
If val [1] in [' C ', 'C'] :
F=1.8 * float (val [0, 1]) + 32
Print (" after the transformation temperature for: {: 2 F} F ". The format (F))
Elif val [1] in [' F ', 'F'] :
C=(float (val [0, 1]) - 32)/1.8
Print (" after the transformation temperature for: {: 2 f} C ". The format (C))
The else:
Print (" I ")
CodePudding user response:
Try:If
Elif
The else
Except the Exception as e:
Print (e)
Should be well
CodePudding user response: