If i run the code then it shows "IdentationError: Unident does not match any outer Identation level
‘except’ must be in the alignment with ‘try’.Accordingly indent statements within the except.
The statements in your except block specifically are not indented properly.
Make sure that the print statements in except block are aligned with the "if " and “sensor_value>…”(in try block).
Hope this helped.
thanks for resolving my problem