Omitting the else Clause: Unary SelectionΒΆ




(ch05_unaryselection)

What would be printed if the value of x is negative? Try it.

Check your understanding

select-5-1: What does the following code print?

x = -10
if x < 0:
    print("The negative number ",  x, " is not valid here.")
print("This is always printed")
a.
This is always printed

b.
The negative number -10 is not valid here
This is always printed

c.
The negative number -10 is not valid here





Next Section - Nested conditionals