October 2016
Beginner to intermediate
650 pages
14h 43m
English
Compound statements contain other statements. This means a test or execution while true or false executes the statements within itself. The trick is to write statements so that they are efficient and effective. Examples of this include if then statements, loops, and exception handling.
An if statement tests for a specific condition, and if that condition is met (or not met), then the statement is executed. The if statement can include a simple check to see whether a variable is true or false, and then print the details, as shown in the following example:
x = 1 if x == 1: print("The variable x has a value of 1")
The if statement can even be used to check for multiple conditions at the same time. Keep in mind ...
Read now
Unlock full access