0
What kind of error is this "IdentationError" expected an idented block.??
Can u explain
6 Answers
+ 1
If you're talking about Python...
Python is a language based on indentation! If... else conditions, while and for loops etc uses indentation! For instance:
a = int(input("Number"))
b = input("Word")
if a > 2:
print("a is greater than 2")
if b == "word":
print("you entered word!")
Is different from...
if a > 2:
print("a is greater than 2")
if b == "word":
print("you entered word!")
Notice the difference? The indentation's different! Don't worry, I also struggled with it when I first knew Python lol đ
But here's the basic:
In Python, every single while/for loops, if... else conditions etc will execute the code indented below them if the condition is true!
if a > 2:
print("a is greater than 2") #This code will only execute if the if statement is true... hence it executes if a is greater than 2!
Happy programming! :)
+ 2
From search bar ..
pls use it befpre posting...
https://www.sololearn.com/Discuss/2697339/?ref=app
Hope it helps...
+ 1
CH. Hemant Kumar Reddy are you talking about Python language? đ€đ€đ€ Please specify the language you are asking next time âșïž
0
Thank u #The Coder for great information
0
I can't find any difference between themđđ
0
CH. Hemant Kumar Reddy look, the second code is slightly more towards the right!
Not indented
Indented
See the difference now? Also, you're welcome :)