Use of “elif” with a conditional

I made a basic program in python with “elif” conditional. Check it out.

elif is short for ‘else if’ and is very helpful when you have too many if statements  in your code and makes your code more efficient and cleaner. You can use this conditional after an if in the next line and to use it you have to put your condition and it will make its job, it will make the action you define if the condition is True or the other action you define if the condition is not True, you can see it in my example:

CC BY 4.0 Use of “elif” with a conditional by Jorge Padilla is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.