Search this site
Embedded Files
Python by Examples
  • Tutorial
    • Download & Install
      • Install Python on Ubuntu Linux
    • Help
  • Strings
    • comparison
    • Get safe character string
    • str() and repr()
  • argparse
    • ValueError
  • Biopython
    • Examples
      • GC content
      • Inverse seq
      • Read/write fasta
    • Install Biopython
  • Data structures
    • Dictionary
      • get keys
      • Multiple keys
    • Lists
      • 0-based indices
      • List element frequencies
      • Median
  • Debugging
  • Error
    • TabError
  • Error handling
    • Check Python version
    • Type checking (raise)
  • File operations
    • File commands
      • get module path
      • os.rename vs shutil.move
      • tar
    • Files: read & write
      • gzip compression
      • Read csv files
      • strip
  • Functions
  • Loops
    • For loops
    • if else ...
    • List Comprehension
  • Math
    • DataFrame
    • Machine Learning
      • Kernel PCA
    • Matrix Calculations
      • Plot
    • Statistics
    • types
  • Packages
    • Create own modules
    • Import Modules
      • Check modul version
    • Install packages
    • python script
  • Parallel processing
    • pool.map - multiple arguments
  • Plot
    • barplot
    • colors
      • rgb2hex
    • matplotlib
      • colormaps
      • Error
      • Transparent colors
  • Print
    • Error
  • System
    • Environment
    • External Commands
  • Time
  • WWW
    • CGI script
    • Download webpage
    • Graphics
Python by Examples

if else ...

Python loops (for, while, if, else)

if a>0:

print('x is positive')

else:

print('x is negative')


if a>0:

print('x is positive')

elif x==0:

print('x is zero')

else:

print('x is negative')


Operators

== equal

!= not equal

> greater than

>= greater than or equal

< smaller than

<= smaller than or equal

Google Sites
Report abuse
Page details
Page updated
Google Sites
Report abuse