About 4,250,000 results
Open links in new tab
  1. If statement for strings in python? - Stack Overflow

    To check a string against a set of strings, use in. Here's how you'd do it (and note that if is all lowercase and that the code within the if block is indented one level). One approach:

  2. if Statement With Strings in Python - Delft Stack

    Feb 22, 2025 · Learn how to effectively use the if statement with strings in Python in this comprehensive guide. Explore various techniques for string comparison, including case …

  3. How to create if statements using strings in python 3.x

    Jun 6, 2016 · Strings need to be in quotes, not inside str(). Use "Red" instead. Your code fixed would look something like: print("Charmander") print("Squirtle") print("Bulbasaur") Since you …

  4. if statement with multiple string in Python - Stack Overflow

    Sep 27, 2014 · I've this if statment that must check if this two string are present on self.line.lower() that can be ex: 123abc567 or blaxyzbla: if 'abc' or 'xyz' in self.line.lower(): print ('Present') else: …

  5. 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 …

  6. Python Conditional Statements and Loops

    These constructs allow you to make decisions and repeat operations, forming the backbone of algorithmic thinking in Python. Conditional Statements in Python. Conditional statements allow …

  7. Python's if statement explained (with example programs)

    Dec 21, 2022 · In plain English, we can read an if statement as: “if this condition is true, execute the following code.” As we can see from this default pattern, Python’s if statement has the …

  8. Mastering the if Statement in Python: A Comprehensive Guide

    Apr 22, 2025 · In the world of programming, decision-making is a fundamental concept. The `if` statement in Python provides a way to execute different blocks of code based on certain …

  9. 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, …

  10. Mastering if-else in Python: A Comprehensive Guide

    6 days ago · In the world of programming, decision-making is a crucial aspect. Python's `if-else` statement is a fundamental tool that allows developers to control the flow of a program based …

  11. Some results have been removed
Refresh