13,420
edits
Changes
→PART 1 - Using IF Statements
ipython3
</source>
:#Let's issue create an if statements statement from the ipython3 shell. Issue the following 2 lines, indenting the second line:<source>
if True:
print('This print is apart of the if statement')
</source>What happened?<br><br>It is important to note a couple of things:<br><br>Indentation means to start a line with spaces or tabs before your text. In Python, indentation can control how the program itself runs. From now on be very careful and consistent in the indetation that you make. Using indentation you can choose what code runs as part of the if statement and what code runs as part of the main program.<br><br>
:#When a if statement is True, it runs the code that is indented underneath it. However if the statement is False it will not run. Any code not indented under the if statement will perform normally.<source>
if False: