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

    "input() evaluates whatever is entered as a Python expression, raw_input() returns a string." Except in Python 3, where input() does what raw_input() used to, and you'd use eval(input()) …

  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 Use IF Statements in Python (if, else, elif, and more ...

    Mar 3, 2022 · In this article, we’ve covered the most important aspects of if conditions in Python: Creating basic if statements; Adding complexity by using else and elif statements; Combining …

  4. If Statements Explained - Python Tutorial

    You can use if statements to make an interactive program. Copy the program below and run it. It has several if statements, that are evaluated based on the keyboard input. Because keyboard …

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

  6. Check multiple conditions in if statement - Python

    Aug 2, 2024 · Here we'll study how can we check multiple conditions in a single if statement. This can be done by using 'and' or 'or' or BOTH in a single statement. Syntax: code1. code2. and …

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

  8. python - if elif with strings - Stack Overflow

    Jan 29, 2013 · You could create a mapping list and use a plain for loop to search for the strings in the mStrVar variable: retVal_mapping = [ ('mString1', 1), ('mString2', 2), ('mString3', 2), …

  9. Python if statement string compare | Example code - EyeHunts

    Jul 19, 2021 · Simple python example code. Use if statement to compare string is equal or not equal? x = 'A' if x == 'c': print("X == C") elif x == 'A': print("X == A") else: print("Not Matched")

  10. Mastering Python’s ‘if’ Statement – Handling String Equality

    Mastering string equality in ‘if’ statements is essential for any Python programmer. Understanding the syntax and structure of ‘if’ statements, as well as the various techniques for comparing …

  11. Some results have been removed
Refresh