Robotics & Artificial Intelligence

Write a Python program to demonstrate the use of the if-elif-else statements.

Python Control Flow

1 Like

Answer

num = 4

if num == 1:
    print("Red")
elif num == 2:
    print("Blue")
elif num == 3:
    print("Green")
elif num == 4:
    print("Yellow")
elif num == 5:
    print("Orange")
else:
    print("Invalid input")

Output

Yellow

Answered By

1 Like


Related Questions