KnowledgeBoat Logo
|

Computer Applications

What are selection statements ? How are they useful ?

Python Control Flow

4 Likes

Answer

A statement that carries out a set of instructions depending upon a condition's result is known as a selection or conditional statement. Python provides selection statements in the form of if and if-else statements.

These statements enable a program to carry out a set of instructions depending upon a condition's result. For example,

num = 5
if num >= 0 :
    print "Positive"
else :
    print "Negative"

Answered By

2 Likes


Related Questions