7 Ways Statements are Completely Underrated.

--Originally published at Carolina's Blog Site

A statement is an instruction that the Python interpreter can execute. Some kinds of statements are while statements, for statements, if statements, and import statements.

  • An if statement is run once if its condition evaluates to True, and never if it evaluates to False.
  • An else statement follows an if statement and introduces a new block of code that will run only if the condition is false.
  • An elif statement combines else & if. Pretty simple.
  • An import statement lets you access the code in another module by the process of importing it.
  • A for statement/loop runs through an iterable Python object, giving you a value until there are no more items left.
  • A while statement/loop is repeatedly executed as long as the condition holds.
    • break: To end a while loop prematurely, use the break statement, which causes the loop to finish immediately.
    • continue: Unlike break, continue jumps back to the top of the loop, rather than stopping it.

Dwight Meme - the below statement is true the above statement is false

 

source: https://memegenerator.net/instance/24442353