greater than or equal to >= equal == not equal != Another feature of the command is the statement. It stands for else if and means if the if elif original statement is false but the part is true, then do the And if neither if elif elifpart. the or expressions are true, then do what's in the block. Here's an example: if elif else a = 0 a < 10: while a = a + 1 if a > 5: print(a, ">", 5) a <= 3: elif "<=", 3) print(a, else: print("Neither test was true") and the output: 1 <= 3 2 <= 3 3 <= 3 Neither test was true Neither test was true 6 > 5 7 > 5 8 > 5 9 > 5 10 > 5 Notice how the is only tested when the statement fails to be true. There can be more than elif a <= 3 if one expression, allowing multiple tests to be done in a singleif statement. elif Examples # This Program Demonstrates the use of the == operator # using numbers print(5 == 6)
>= greater than or equal to == equal != not equal Another feature of the if command is the elif statement. It stands for else if and means if the original if statement is false but the elif part is true, then do the elifpart. And if neither the if or elif expressions are true, then do what's in the else block. Here's an example: a = 0 while a < 10: a = a + 1 if a > 5: print(a, ">", 5) elif a <= 3: print(a, "<=", 3) else: print("Neither test was true") and the output: 1 <= 3 2 <= 3 3 <= 3 Neither test was true Neither test was true 6 > 5 7 > 5 8 > 5 9 > 5 10 > 5 Notice how the elif a <= 3 is only tested when the if statement fails to be true. There can be more than one elif expression, allowing multiple tests to be done in a singleif statement. Examples # This Program Demonstrates the use of the == operator # using numbers print(5 == 6)
Python%20Lab%204.docx