0

What kind of error is this "IdentationError" expected an idented block.??

Can u explain

26th Feb 2021, 12:04 PM
Downey Dewy
Downey Dewy - avatar
6 odpowiedzi
+ 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! :)
26th Feb 2021, 12:32 PM
TheCoder
+ 2
From search bar .. pls use it befpre posting... https://www.sololearn.com/Discuss/2697339/?ref=app Hope it helps...
26th Feb 2021, 12:33 PM
Jayakrishna 🇮🇳
+ 1
CH. Hemant Kumar Reddy are you talking about Python language? 🤔🤔🤔 Please specify the language you are asking next time ☺️
26th Feb 2021, 12:26 PM
TheCoder
0
Thank u #The Coder for great information
26th Feb 2021, 1:23 PM
Downey Dewy
Downey Dewy - avatar
0
I can't find any difference between them😑😑
26th Feb 2021, 1:32 PM
Downey Dewy
Downey Dewy - avatar
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 :)
26th Feb 2021, 1:39 PM
TheCoder