In an if-elif-else block, the first true statement will end the code. But, how can you check for multiple statements without terminating the program? Multiple if statements are the answer. Example:
if 1+8 == 4:
print("Incorrect!")
if 2+3 == 4:
print("InCorrect!")
if 2+2 == 4:
print("Correct!")
else:
print("Enter valid numbers!")
--------------------------Subscribe-----------------------------
• If you like to see a variety of fun and interactive projects written in Python
• If you love ☕ and 🐶 WAIT! - Yeah! Definitely, coffee and dogs!
-----------------------------------------------------------------------
--------------------------Socials-----------------------------
• Twitter: https://twitter.com/ifTodd1
• Facebook: https://www.facebook.com/ifTodd
• Instagram: https://www.instagram.com/if_todd/
------------------------------------------------------------------
--------------------------Support-----------------------------
You can support me here: https://www.patreon.com/if_Todd
--------------------------------------------------------------------
This is how to check for multiple instances #python #shorts #conditionalstatement
0 Comments