Help out with if statement | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help out with if statement

I don't seem to understand anything in If statement especially the indentation. Can someone explain to me in simplest form by siting examples that I will understand easily. Please, explain indentation in simplest form for me backing it with examples.

4th Jan 2021, 9:24 PM
Yinka Bello
Yinka Bello - avatar
8 Answers
+ 2
Yinka Bello I think this may help you to understand the concept of indentation in python. It's very very very important. https://code.sololearn.com/cPbFqB2JOP4m/?ref=app
4th Jan 2021, 9:58 PM
Stefan
Stefan - avatar
+ 1
Which language? I suppose it's Python
4th Jan 2021, 9:35 PM
Stefan
Stefan - avatar
+ 1
Yes. I am talking about python. Pls use simplest example for the indentation sir. Bless ur heart
4th Jan 2021, 9:46 PM
Yinka Bello
Yinka Bello - avatar
+ 1
Stefan , thanks so much. I learnt indentation simply means space or tabs. please, what am I suppose to space and how many spaces should one live behind? Please explain indentation in a very simple way backing it with few examples so that I can run it and see the results
4th Jan 2021, 10:06 PM
Yinka Bello
Yinka Bello - avatar
+ 1
Yinka Bello you can decide how the length of the tabs/spaces can be. But they all may match to an indentation level and as said what you want to express Indentation means first "space" but in python they are very important, these spaces. We use them with: *If statements *For statements *While statements *Try ... except statements *... There are many domains. Sorry for my English level. Mother tongue: French
4th Jan 2021, 10:17 PM
Stefan
Stefan - avatar
0
Yes, my python
4th Jan 2021, 9:38 PM
Yinka Bello
Yinka Bello - avatar
0
Assuming Python Indentation is a way to associate blocks of code to a previous line of code. Example: for i in range(6): print(i) # 0,1,2,3,4,5, if i%2 ==0: print(i) # 0,2,4 As you can see, all the indented items belong to the first line, but the different indented levels cause the code to react to the line it is indented from. Hope this helps
4th Jan 2021, 9:44 PM
Rik Wittkopp
Rik Wittkopp - avatar
0
Stefan , let me have your watsap number
4th Jan 2021, 10:43 PM
Yinka Bello
Yinka Bello - avatar