You can use conditional clauses:

2 import random

which produces:

2 45 is odd

Since it is obvious that else closes the first if block, there is no need for a pass statement, and using one would be incorrect. However, you must explicitly close the else block with a pass .

Recall that in Python "else if" is written elif as in the following example:

2 import random

It produces:

2 64 is divisible by 4

Was this article helpful?

0 0

Post a comment