About 1,790,000 results
Open links in new tab
  1. when to use if vs elif in python - Stack Overflow

    Apr 1, 2014 · That's where elif comes in handy to prevent such thing from happening, which is the primary benefit of using it. The other secondary good benefit of using elif instead of multiple if …

  2. python - What is the correct syntax for 'else if'? - Stack Overflow

    "Elif" seems to have originated with the C preprocessor, which used #elif long before Python AFAICT. Obviously, in that context having a single-token directive is valuable, since parsing …

  3. python - Difference between multiple if's and elif's? - Stack Overflow

    Feb 14, 2012 · Multiple if's means your code would go and check all the if conditions, where as in case of elif, if one if condition satisfies it would not check other conditions..

  4. python - Diferença entre If e Elif - Stack Overflow em Português

    Nov 26, 2016 · 2 O If serve para verificar uma condição e o elif serve para verificar outra condição caso a condição do If seja falsa. No código não há muita diferença, o elif vai garantir …

  5. python - Putting an if-elif-else statement on one line? - Stack …

    Dec 25, 2012 · Is there an easier way of writing an if-elif-else statement so it fits on one line? For example, if expression1: statement1 elif expression2: statement2 else: statement3 Or a real …

  6. else if vs elif in python, are they equal? - Stack Overflow

    10 Assuming the invalid syntax is a typo, the big benefit of elif vs having an else statement with a nested if is indentation. Each time you go into a nested if you'll need to indent again, which will …

  7. Python, why elif keyword? - Stack Overflow

    Python, OTOH, uses indentation to indicate block structure, which forces the block structure to look the same to a human reader as it does to the interpreter 2. Once you've got if and else in …

  8. Python 2.7 if / elif statement with or - Stack Overflow

    Jan 6, 2016 · Python 2.7 if / elif statement with or Asked 9 years, 9 months ago Modified 5 years, 1 month ago Viewed 33k times

  9. python - ¿Hay diferencia entre if y elif? - Stack Overflow en español

    Hay una diferencia fundamental, si usas if encadenados todas las expresiones son evaluadas siempre, aunque una previa sea cierta: a = 15 if a % 5 == 0: print(f"{a} es divisible entre 5") if a …

  10. python - Creating if/else statements dependent on user input

    if prompt1 == 'yes': print 'Hooray, I can!' elif prompt1 == 'no': print 'Well I did anyway!' else: print 'Huh?' #an answer that wouldn't be yes or no raw_input is used instead of input. input in …