Problem with temperature sensor code

In Project 9, when I run the main code, Im getting the following syntax error.

1 Like

@saudamini.v.tergaonk Make sure your code is properly indented, in python indentation is all you need to take care of.
Thank you, Hope this helps, do respond if not found working ! :slight_smile:

It says there’s a syntax error rather than an indentation error…

@saudamini.v.tergaonk. try writing the code with proper indentation .python also shows error if spaces and tabs are mixed .write the code using tab rather than spaces.And try not to give space for ‘:’ after try.

I did that initially, but the error still remains. Could there be any other solution to it?
I tried it without the try except block, but I got an error in the line:


It was again a syntax error

Try leaving 4 spaces in the lines below from the point where you have written try:
I too encountered this problem,since then I am leaving 4 spaces in the new line after a while statement or if statement or try.See if it works for you.
Something like this:

If not working do reply.

1 Like

Hi @saudamini.v.tergaonk,

Just before the try block, there is a print statement where you forgot to close the closing bracket ) .

Do let me know in case you need any other information.

1 Like

Thankyou so much! I should have checked the code with a keener eye.

1 Like