Expected an indented block & isn’t this how we write condition in python for if else? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Expected an indented block & isn’t this how we write condition in python for if else?

num=[1,2,3] If 1 in num : print(“available “) else: print(“not available ”) Expected an indented block in line 3

25th Aug 2020, 1:33 PM
Abhishek
Abhishek - avatar
3 Answers
+ 2
''' leave some spaces before print statement and you're good to go. here's the valid code ''' num=[1,2,3] if 1 in num : print("available ") else: print("not available ") Please revise your python course again Abhishek https://www.sololearn.com/Course/Python/?ref=app
25th Aug 2020, 1:36 PM
Rohit
+ 1
here's the fixed code, can't explain since there were a lot of errors: num=[1,2,3] a = 1 if a in num: print("available") else: print("not available")
25th Aug 2020, 1:38 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
0
I=1 While i<=5: print(I) I=i+1 print("finished")
3rd Sep 2020, 8:50 AM
David
David - avatar