An else clause is the final alternative in an if-elif-else decision. It runs when none of the preceding conditions is true; only the first matching branch runs. section 14.2
Listing 14.3. Example of a simple if-elif-else conditional statement
num = int(input("Enter a number: ")) #1
if num > 0: #2
print("num is positive") #3
elif num < 0: #4
print("num is negative") #5
else: #6
print("num is zero") #7
The number check shows else handling the remaining case: when a number is neither positive nor negative, it prints that the number is zero. section 14.2




