About 27,500,000 results
Open links in new tab
  1. Python If Statement - W3Schools

    These conditions can be used in several ways, most commonly in "if statements" and loops. An "if statement" is written by using the if keyword. In this example we use two variables, a and b, which are used as part of the if statement to test whether b is greater than a.

  2. Python if, if...else Statement (With Examples) - Programiz

    In computer programming, we use the if statement to run a block of code only when a specific condition is met. In this tutorial, we will learn about Python if...else statements with the help of examples.

  3. How to Use IF Statements in Python (if, else, elif, and more ...

    Mar 3, 2022 · In Python, if statements are a starting point to implement a condition. Let’s look at the simplest example: When <condition> is evaluated by Python, it’ll become either True or False (Booleans).

  4. Python - if , if..else, Nested if, if-elif statements - GeeksforGeeks

    Mar 7, 2025 · if Statement in Python. If the simple code of block is to be performed if the condition holds true then the if statement is used. Here the condition mentioned holds then the code of the block runs otherwise not. Python if Statement Syntax. if condition: # Statements to execute if condition is true. Flowchart of if Statement in Python

  5. Python If Else Statements – Conditional Statements

    Mar 8, 2025 · In Python, If-Else is a fundamental conditional statement used for decision-making in programming. If…Else statement allows to execution of specific blocks of code depending on the condition is True or False. if statement is the most simple decision-making statement.

  6. python - Putting a simple if-then-else statement on one line

    How do I write an if - then - else statement in Python so that it fits on one line? count = 0. count = N + 1. That's more specifically a ternary operator expression than an if-then, here's the python syntax. Better Example: (thanks Mr. Burns) Now with assignment and contrast with if syntax. vs. It's very much like comprehensions.

  7. Python Conditional Statements and Loops

    Conditional statements and loops are essential tools in Python programming. They enable you to create dynamic programs that can make decisions and process data efficiently. Mastering these concepts will help you write more effective Python code, whether you’re building machine learning models with TensorFlow, creating visualizations with ...

  8. Python if-then Statements: A Comprehensive Guide

    Mar 20, 2025 · Understanding how to use if-then statements effectively is crucial for writing logical, conditional, and efficient Python programs. This blog post will delve into the fundamental concepts, usage methods, common practices, and best practices of Python if-then statements. What is an if-then statement?

  9. Conditional Statements in Python

    In this step-by-step tutorial you'll learn how to work with conditional ("if") statements in Python. Master if-statements and see how to write complex decision making code in your programs.

  10. Conditions: if, then, else - Learn Python 3 - Snakify

    This program uses a conditional statement if. After the if we put a condition (x > 0) following by a colon. After that we put a block of instructions which will be executed only if the condition is true (i.e. evaluates to True ).

  11. Some results have been removed