Intellipaat

Intellipaat

Explore Online Courses Free Courses Hire from us Become an Instructor Reviews
All Courses
  • Articles
  • Tutorials
  • Interview Questions
Home > Blog > Tutorials > Python Tutorial For Beginners > What Does “elif” Mean in Python?

What Does “elif” Mean in Python?

By Lithin Reddy | Last updated on October 14, 2025 | 18716 Views
Share this article
Previous
Next
Tutorial Playlist
    • Python Tutorial For Beginners
    • Python Itertools
    • How to use Python numpy.where() Method?
    • Python Break & Continue statements
    • What Does “elif” Mean in Python?
    • Magic Methods In Python
    • Python Fundamentals - Learn Python Basics
    • Introduction and History of Python
    • What is Python Programming Language?
    • Python Version History
    • Top 10 Python Frameworks
    • Python Download - How To Install Python [Easy Steps]
    • Python Syntax: A Guide To Writing Basic Python Code
    • What are comments in python
    • Python Input and Output Commands
    • Python Data Types: Complete Guide with Examples (2026)
    • Python Variables
    • Python Numbers - Learn How to Create Prime Numbers, Perfect Numbers, and Reverse Numbers in Python
    • Strings in Python
    • Python Lists - A Complete Guide (With Syntax and Examples)
    • Tuples in Python
    • Python Set - The Basics
    • Dictionaries in Python - From Key-Value Pairs to Advanced Methods
    • Python Operators
    • Python Modules, Regular Expressions & Python Frameworks
    • Type Conversion in Python
    • Python If Else Statements - Conditional Statements with Examples
    • Python While Loop
    • Python for Loops - A Step-by-Step Guide
    • Python Function - Example & Syntax
    • Python Lambda Functions - A Beginner's Guide
    • Python Built-in Functions
    • Python Arrays - The Complete Guide
    • Python Classes and Objects
    • Introduction to Python Modules
    • Python Datetime - A Guide to Work With Dates and Times in Python
    • Python JSON - Parsing, Creating, and Working with JSON Data
    • What is Regular Expression in Python
    • How to Install Pip in Python
    • File Handling in Python
    • Exception Handling in Python with Examples
    • Enumerate() in Python - A Detailed Explanation
    • Python Queue Tutorial: Queue Module, Deque & Priority Queue (2026)
    • Numpy - Features, Installation and Examples
    • SciPy in Python Tutorial
    • Python Scikit-Learn
    • Python Pandas - Features and Use Cases (With Examples)
    • Introduction to Matplotlib in Python
    • Python Cheat Sheet - Basics to Regex, Syntax, and Data Types [UPDATED]
    • Data Structures with Python Cheat Sheet
    • NumPy Cheat Sheet
    • Scikit-Learn Cheat Sheet: Python Machine Learning
    • Pandas Cheat Sheet
    • List Comprehension in Python
    • Web Scraping with Python - A Step-by-Step Tutorial
    • Python Tutorial For Beginners
    • Python Itertools
    • How to use Python numpy.where() Method?
    • Python Break & Continue statements
    • What Does “elif” Mean in Python?
    • Magic Methods In Python
    • Python Fundamentals - Learn Python Basics
    • Introduction and History of Python
    • What is Python Programming Language?
    • Python Version History
    • Top 10 Python Frameworks
    • Python Download - How To Install Python [Easy Steps]
    • Python Syntax: A Guide To Writing Basic Python Code
    • What are comments in python
    • Python Input and Output Commands
    • Python Data Types: Complete Guide with Examples (2026)
    • Python Variables
    • Python Numbers - Learn How to Create Prime Numbers, Perfect Numbers, and Reverse Numbers in Python
    • Strings in Python
    • Python Lists - A Complete Guide (With Syntax and Examples)
    • Tuples in Python
    • Python Set - The Basics
    • Dictionaries in Python - From Key-Value Pairs to Advanced Methods
    • Python Operators
    • Python Modules, Regular Expressions & Python Frameworks
    • Type Conversion in Python
    • Python If Else Statements - Conditional Statements with Examples
    • Python While Loop
    • Python for Loops - A Step-by-Step Guide
    • Python Function - Example & Syntax
    • Python Lambda Functions - A Beginner's Guide
    • Python Built-in Functions
    • Python Arrays - The Complete Guide
    • Python Classes and Objects
    • Introduction to Python Modules
    • Python Datetime - A Guide to Work With Dates and Times in Python
    • Python JSON - Parsing, Creating, and Working with JSON Data
    • What is Regular Expression in Python
    • How to Install Pip in Python
    • File Handling in Python
    • Exception Handling in Python with Examples
    • Enumerate() in Python - A Detailed Explanation
    • Python Queue Tutorial: Queue Module, Deque & Priority Queue (2026)
    • Numpy - Features, Installation and Examples
    • SciPy in Python Tutorial
    • Python Scikit-Learn
    • Python Pandas - Features and Use Cases (With Examples)
    • Introduction to Matplotlib in Python
    • Python Cheat Sheet - Basics to Regex, Syntax, and Data Types [UPDATED]
    • Data Structures with Python Cheat Sheet
    • NumPy Cheat Sheet
    • Scikit-Learn Cheat Sheet: Python Machine Learning
    • Pandas Cheat Sheet
    • List Comprehension in Python
    • Web Scraping with Python - A Step-by-Step Tutorial
`; ip_get_section_iq.innerHTML = sidebarhtml_desk; playlistmobile.innerHTML = sidebarhtml_desk; var ip_iq_scriptToRemove = document.getElementById('ip-blog-iq-script-removal'); if (ip_iq_scriptToRemove) { ip_iq_scriptToRemove.remove(); } var activeSubmenuItems = document.querySelectorAll('.tutorial_list_submenu li.active'); activeSubmenuItems.forEach(function(activeItem) { var rootParentLi = activeItem.closest('.maincata'); if (rootParentLi) { rootParentLi.classList.add('opentutorialsubmenu'); } }); var ip_blog_tutorialListMenu = document.querySelector('.tutorial_list_menu'); if(ip_blog_tutorialListMenu){ var ip_blo_activeItem = ip_blog_tutorialListMenu.querySelector('li.active'); var lastlink = ''; var nextlink = ''; var total = 0; jQuery('#TutorialLeftArea .maincata ul').children('li').each(function(indexx) { total = indexx; }); jQuery('#TutorialLeftArea .maincata ul').children('li').each(function(i) { var isActive = jQuery(this).hasClass('active'); if(isActive){ if(i !== 0){ var lastIndexedElement = jQuery('#TutorialLeftArea .maincata ul').children('li').eq(i - 1); lastlink = lastIndexedElement.children('a').attr('href'); }else{ lastlink = ''; } if(total > i){ var nextIndexedElement = jQuery('#TutorialLeftArea .maincata ul').children('li').eq(i + 1); nextlink = nextIndexedElement.children('a').attr('href'); }else{ nextlink = ''; } return false; } }); var ip_blog_prevBlog = document.querySelector('.prev-blog a'); var ip_blog_nextBlog = document.querySelector('.next-blog a'); if (lastlink !== '' && typeof lastlink !== 'undefined') { ip_blog_prevBlog.setAttribute('href', lastlink); }else { if(ip_blog_prevBlog){ ip_blog_prevBlog.style.display = 'none'; } } if (nextlink !== '' && typeof nextlink !== 'undefined') { ip_blog_nextBlog.setAttribute('href', nextlink); }else { if(ip_blog_nextBlog){ ip_blog_nextBlog.style.display = 'none'; } } } function ip_blog_setActiveLink() { var divElements = document.querySelectorAll('div[id]'); var links = document.querySelectorAll('.interview-question-bookmark-list-alt li a'); var activeLink = null; divElements.forEach(function(div) { if (ip_blog_isInViewportThreshold(div, 50)) { var ip_blog_divId = div.getAttribute('id'); links.forEach(function(link) { if (link.getAttribute('href') === '#' + ip_blog_divId) { activeLink = link; } }); } }); links.forEach(function(link) { link.classList.remove('active'); }); if (activeLink) { activeLink.classList.add('active'); } } function ip_blog_isInViewportThreshold(element, threshold) { var rect = element.getBoundingClientRect(); var windowHeight = window.innerHeight || document.documentElement.clientHeight; var topThreshold = rect.top - threshold; var bottomThreshold = rect.bottom + threshold; return topThreshold <= windowHeight && bottomThreshold >= 0; } window.addEventListener('scroll', ip_blog_setActiveLink); window.addEventListener('load', ip_blog_setActiveLink); }); function ip_blg_findClosestAnchor(element) { while (element) { if (element.tagName === 'A') { return element; } element = element.parentNode; } return null; } function ip_bl_v_scrollToDiv(event_pb, offset) { event_pb.preventDefault(); const ip_bl_linkElement = ip_blg_findClosestAnchor(event_pb.target); if (ip_bl_linkElement) { const it_bl_hashValue = ip_bl_linkElement.getAttribute('href').substring(1); const it_blg_vf_targetElement = document.getElementById(it_bl_hashValue); if (it_blg_vf_targetElement) { jQuery('html, body').animate({ scrollTop: jQuery('#' + it_bl_hashValue).offset().top - offset }, 1000); } } } document.addEventListener('DOMContentLoaded', function() { let it_bl_offset = 0; const ip_blo_vi_anchorLinks = document.querySelectorAll('a[href^="#"]'); ip_blo_vi_anchorLinks.forEach(function(linkip_bg) { linkip_bg.addEventListener('click', function(event_pb) { setTimeout(function() { console.log('Offset passed during click: ' + it_bl_offset); ip_bl_v_scrollToDiv(event_pb, it_bl_offset); }, 0); }); }); });
See More

When you are programming in Python, you often have to make decisions in your code about certain conditions. That is where conditional statements help. One keyword that is very important in Python’s conditional statements is elif. In this blog, we will discuss what is elif and how to use it.

Table of Contents

    • What is a Conditional Statement?
    • What Does elif Mean?
    • Example with elif

What is a Conditional Statement?

conditionals

With the help of conditional statements in Python, we can run different pieces of code depending on whether certain conditions are true or false. If is the most basic conditional statement in Python, which checks the condition first and then runs the code if the condition is true.

Example:

Python
Code Copied!

Output:
x is greater than 5

Here, x is 10 which is greater than 5, which makes the condition true. So, it will print “x is greater than 5” as shown in the above output.

But if you have more than one statement, then an elif statement will be used.

What Does elif Mean?”>

What Does elif Mean?

The keyword elif stands for “else if.” It’s used to check multiple conditions in a sequence. After an if statement, you can use elif to check additional conditions. Each elif statement only runs if the previous conditions are false.

For example, let’s say you want to check if a number is positive, negative, or zero. You can use elif to check for multiple conditions:

Example

Python
Code Copied!

In this example:
  • If x is greater than 0, it will print “x is positive.”
  • If x is less than 0, it will print “x is negative.”
  • If neither of those is true, it will print “x is zero.”
Master Python for the Real World!
Industry-Ready Training for Future-Ready Professionals. Learn from Experts, Build Projects, and Advance Your Career!
Explore Program
quiz-icon

Why Use elif?

Instead of checking each condition with separate if statements, you can use elif to make your code easier to read and more organized. It helps you check different conditions in order without needing a lot of complicated code.

Example with elif

Let’s say you want to give grades based on a student’s score. Here’s how you might do it using elif:

Example:

Python
Code Copied!

In this example:
  • If the score is 90 or more, it will print “Grade: A.”
  • If the score is 80 or more (but less than 90), it will print “Grade: B.”
  • If the score is 70 or more (but less than 80), it will print “Grade: C.”
  • If the score is 60 or more (but less than 70), it will print “Grade: D.”
  • If none of the conditions are true, it will print “Grade: F.”
Master Python – Free Online Course!
Learn Python from scratch and gain skills to tackle real-world projects with Intellipaat Academy.
Explore Program
quiz-icon

How Does It Work?

Python checks the conditions one by one:

  1. First, it checks if the score >= 90. If it’s true, it prints “Grade: A” and stops.
  2. If the first condition is false, it checks a score >= 80. If that’s true, it prints “Grade: B” and stops.
  3. If both of the above conditions are false, it checks the next condition, and so on.

Once it finds a true condition, Python stops checking the rest.

Get 100% Hike!

Master Most in Demand Skills Now!

Conclusion

So far in this article, we learned about conditional statements such as if and elif. It helps us to check the different cases one by one without writing a lot of unorganized code. With the help of elif, you can make your code easier to understand and more organized, even if your code contains multiple conditions. If you want to learn more about conditional statements and operators in Python, check out Intellipaat’s Python course.

 

The below resources provide a solid foundation in Python, covering key concepts, syntax, and basic operators.

Magic Method in Python – Learn about magic methods in Python through clear examples.

Break and Continue – Discover how break and continue work in Python, illustrated with helpful examples.

Python Reserved Words – Covers Python reserved words and demonstrates their use with examples.

Python Interactive Mode Chevron – Overview of Python’s interactive mode and chevron prompt with real-world examples.

Global Variable in Function – Explore how global variables behave inside functions in Python, with detailed examples.

Python Yield Keyword – Understand the yield keyword in Python and how it functions, supported by sample code.

Python Tuple – Take a closer look at tuples in Python, with explanations and practical examples.

Set Attribute Error – Learn what causes a setattr error in Python and how to handle it, using examples.

2D Array Input – See how to take input for a 2D array in Python through easy-to-follow examples.

About the Author

Lithin Reddy
Lithin Reddy
Data Scientist | Technical Research Analyst - Analytics & Business Intelligence

Lithin Reddy is a Data Scientist and Technical Research Analyst with around 1.5 years of experience, specializing in Python, SQL, system design, and Power BI. Known for building robust, well-structured solutions and contributing clear, practical insights that address real-world development challenges.

Recommended Videos
Python Interview Questions And Answers
Python Interview Questions And Answers
Numpy Interview Questions For Freshers
Numpy Interview Questions For Freshers
Pandas Coding Interview Questions
Pandas Coding Interview Questions
OOPS Interview Questions and Answers
OOPS Interview Questions and Answers
Python Pandas Tutorial
Python Pandas Tutorial
Recommended Programs
Python Course
Python Course
5 (218118)
Free Python Certification Course Online
Free Python Certification Course Online
5 (53455)
Python Data Science Course
Python Data Science Course
5 (76533)
Software Development Engineering Course
Software Development Engineering Course
5 (23421)

Course Preview

Expert-Led No.1

What Does “elif” Mean in Python?

Intellipaat

facebook twitter linkedin youtube insta telegram

Intellipaat

facebook twitter linkedin youtube insta telegram

Get Our App Now!

Intellipaat android app Intellipaat android app

Get Our App Now!

Intellipaat android app Intellipaat android app

Courses

  • Data Scientist Course
  • Machine Learning Course
  • Python Course
  • Devops Training
  • Business Analyst Certification
  • Cyber Security Courses
  • Business Analytics Training
  • Investment Banking Course
  • SQL Course
  • AWS DevOps Course
  • Full Stack Developer Course
  • Product Management Course

Courses

  • AWS Solutions Architect
  • UI UX Design Course
  • Salesforce Training
  • Selenium Training
  • Artificial Intelligence Course
  • Ethical Hacking Course
  • Azure Administrator Certification
  • Cyber Security Course
  • Digital Marketing Course
  • Electric Vehicle Course
  • Azure DevOps Course
  • Web Development Courses

Tutorials

  • Python Tutorial
  • AWS Tutorial
  • Devops Tutorial
  • Java Tutorial
  • Node Js Tutorial
  • Cyber Security Tutorial
  • Salesforce Tutorial
  • Azure Tutorial
  • Ethical Hacking Tutorial
  • Data Science Tutorial
  • Cloud Computing Courses
  • Python Data Science Course

Interview Questions

  • Python Interview Questions
  • AWS Interview Questions
  • Data Science Interview Questions
  • Devops Interview Questions
  • Salesforce Interview Questions
  • Java Interview Questions
  • SQL Interview Questions
  • React Interview Questions
  • Node Js Interview Questions
  • Digital Marketing Interview Questions

Browse By Domains

Data Science Salesforce Courses Cloud Computing Courses AI & Machine Learning Courses Project Management Courses Cyber Security and Ethical Hacking Courses Web Development Courses Job Oriented Courses Degree Courses Marketing CRM Courses Software Development Courses Doctorate Programs Undergraduate Courses Banking and Finance Courses Product Design Courses Electric and Hybrid Vehicle Courses Leadership & Management Courses Management Courses Generative AI Courses Design Thinking Courses Microsoft Certification Courses

Top Tutorials

Machine Learning Tutorial Power BI Tutorial SQL Tutorial Artificial Intelligence Tutorial Digital Marketing Tutorial Data Analytics Tutorial UI/UX Tutorial

Top Articles

Cloud Computing Data Science Machine Learning What is AWS Digital Marketing Cyber Security Salesforce Artificial Intelligence

Top Interview Questions

Selenium Interview Questions Azure Interview Questions Machine Learning Interview Questions Cyber Security Interview Questions Business Analyst Interview Questions and Answers C Interview Questions Data Analyst Interview Questions Software Engineering Interview Questions

© Copyright 2011 - 2026 Intellipaat Software Solutions Pvt. Ltd.
Media
Contact Us
Tutorials
Interview Questions

Address: 6th Floor, Primeco Towers, Arekere Gate Junction, Bannerghatta Main Road, Bengaluru, Karnataka 560076, India.

Disclaimer: The certification names are the trademarks of their respective owners.

INTPL_2026-05-19