Sytnax error while adding "Exception" in python

Hi

This error has arised because of the wrong indentation done in your python script.
so try changing the code as follows : ( FOLLOW THE INDENTATION )

If any issues still occurs please let me know!

Happy learning :man_student:t2:

1 Like

thanks a lot for your effort and explanation brother! didn’t know about the indentation

cool ! Don’t worry if there is anything just ask it don’t hesitate.

If you think the above solution has helped you please do give it a thumbs up!

Enjoy!

Hello @iamadhi47,
Don’t worry Indentation is nothing but the correct spacing.
Programming languages like C we can specify the block of codes(loops,if statements etc,) using the curly braces{ } but in python it is specified using the spaces from the line starting(indentation).
So,solving the issue is done by retyping the code without any extra or insufficient spaces.
Try this and let me know once the issue is solved

In python,Indentation problem is face more about every programmer.

while(True):
<4 spaces(not TAB)>{code}
try:
<4 spaces(not TAB)>{code}
<4 spaces(not TAB)>if(condition)
<4 spaces(not TAB)><4 spaces(not TAB)>{code}
except 

Please remember in python program we use space bar (4 spaces) not TAB(8 spaces).

In Python Programming language indentation is very important. The try block should always be followed by an except block, in order to handle errors. Hence both should have the same indentation

I am facing troubles with the telegram alert system. There is an indentation error I’m unable to identify. If you could help me rectify it.

Any help from you side is much appreciated!!!:pray:t2::pray:t2::pray:t2: