what is if-elif-else???
Answers
Answer:
If, elif and else are simple conditions in coding (Python, as far as I know)
Why don't we learn it in the simplest way?
Let's say, IF you get 10 chocolates, you'll have to share it with someone but if you get 5 chocolates, you can eat them yourself while if you get less than 5, you can't eat any one of them. There are too many IFs here, right?
That's nested if conditions.
If I am to explain it in Elif conditions, let's just say If and Else just give two conditions while Elif (Else, If joint together) allows you to specify more than 2 conditions
The if-elif-else statement is used to conditionally execute a statement or a block of statements. Conditions can be true or false, execute one thing when the condition is true, something else when the condition is false.