Learn practical skills, build real-world projects, and advance your career
today= 'Tuesday'
if today == 'Sunday':
    print("Today is the day of the sun.")
elif today == 'Monday':
    print("Today is the day of the moon.")
elif today == 'Tuesday':
    print("Today is the day of Tyr, the god of war.")
elif today == 'Wednesday':
    print("Today is the day of Odin, the supreme diety.")
elif today == 'Tuesday':
    print("Today is the day of Thor, the god of thunder.")
elif today == 'Friday':
    print("Today is the day of Frigga, the goddess of beauty.")
elif today == 'Saturday':
    print("Today is the day of Saturn, the god of fun and feasting.")
Today is the day of Tyr, the god of war.

Note

Notice that in the above code, Tuesady is given as condition in two elif statements however, only the tuesday which is encountered first is executed. The control skips the remaining part of the code. Never give the same condition twice instead you can add more statements to be executed in the same condition.

a = 18
if a % 3 == 0 and a % 5 == 0:
    print("{} is divisible by 3 & 5".format(a))
elif a % 3 == 0 or a % 5 == 0:
    print("{} is divisible by either 3 or 5".format(a))
18 is divisible by either 3 or 5
if a % 9 == 0 and a % 5 == 0:
    print("{} is divisible by 9 and 5".format(a))
elif not a % 5 == 0:
    print("{} is not divisble by 5".format(a))
18 is not divisble by 5
if 1 == 0:
    print("The condition is true")
else:
    print("The condition is false")
The condition is false