Python - Conditional Execution
Python - Conditional Execution
x = 5
Conditional Steps
Yes
X < 10 ?
Program:
print 'Smaller' Yes
X > 20 ?
print 'Bigger'
x = 5 if x < 10:
print 'Smaller'
if x > 20: print 'Bigger'
Output:
Smaller Finis
print 'Finis'
print 'Finis'
Comparison Operators
-- Boolean expressions produce a Yes or No result, which use to control program flow
-- Boolean expressions using comparison operators evaluate to - True / False - Yes / No
-- Comparison operators look at variables but do not change the variables
Python
< =
> !=
Meaning
Less than Less than or Equal
Equal to
Greater than or Equal
Greater than Not equal
Remember: "=" is used for assignment.
x = 5 if x == 5 :
print 'Equals 5' if x > 4 :
print 'Greater than 4' if x >= 5 :
print 'Greater than or Equal 5' if x < 6 : print 'Less than 6' if x ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- operators and expressions
- predicting if income exceeds 50 000 per year based on
- python working with pixels villanova
- recommended system requirements
- 4 basic operators
- python chapter 2 if statement random class
- python while loop rxjs ggplot2 python data persistence
- python programming an introduction to computer science
- 5 constraint satisfaction problems
- shape analysis measurement purdue university
Related searches
- execution the foregoing powers
- strategy execution management software
- project execution strategy
- strategy execution process
- parallel execution python
- execution of ww2 war criminals
- execution of german officers
- execution of nazis
- execution of nazis after war
- execution of socrates
- project execution plan pdf
- sample task execution plan