+ 1

why is indentation error occur in pythen

8th Jun 2019, 7:30 AM
Ranjeet singh jitty
Ranjeet singh jitty - avatar
5 ответов
+ 5
a=5 if a==5: print('yes') else: print('no') This is correct version of your code. Python does not supports {}(Curly Braces) to define a block. Instead of {} it uses indentation. For indentation you can use spaces and tabs. But the number of space or tabs before various line in same block should same. In the above code you has a space before if statement that was the problem 😁
8th Jun 2019, 7:42 AM
Deepak Kumar
Deepak Kumar - avatar
+ 3
thank you deepak and olin
8th Jun 2019, 7:56 AM
Ranjeet singh jitty
Ranjeet singh jitty - avatar
+ 1
a=5 if a==5: print('yes') else: print('no')
8th Jun 2019, 7:35 AM
Ranjeet singh jitty
Ranjeet singh jitty - avatar
+ 1
a=5 if a==5: print('yes') else: print('no') you dont need to add spaces before the if statement
8th Jun 2019, 7:41 AM
Cat Sauce
Cat Sauce - avatar
0
can you send the code
8th Jun 2019, 7:30 AM
Cat Sauce
Cat Sauce - avatar