Send
Close Add comments:
(status displays here)
Got it! This site "robinsnyder.com" uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website. Note: This appears on each machine/browser from which this site is accessed.
Code and data driven programming
1. Code driven programming
Code-drive programming involving control flow uses program code to achieve an effect.
2. Data driven programming
Data-driven programming (sometimes involving data flow) uses data to help achieve an effect.
3. Integer division
Note that in Python 2, the division operator "/" does an integer division if both operands are integer.
Note that in Python 3, the division operator "/" does an floating point division.
Note that in Python 3, the division operator "//" does an integer division.
Here is the Python code [#1]
Here is the output of the Python code.
Notice that there is no select statement in Python. One uses a series of else-if statements.
Is there a better way?
Here is the Python code [#2]
Here is the output of the Python code.
4. Arithmetic operations
Consider the evaluation of arithmetic operations.
Here is the Python code [#3]
Here is the output of the Python code.
5. Function variables
Python, like many newer languages, supports functional programming concepts of functional variables.
C# makes this somewhat cumbersome via delegates.
Java makes this very cumbersome via interfaces.
Here is the Python code [#4]
Here is the output of the Python code.
6. Lambda functions
A lambda construct is a way to make an anonymous function. When you see
lambda, think "
make function".
The name has a historical origin - from the lambda calculus as a way to determine the limits of computation.
lambda calculus by Alonzo Church - functional way
Turning machine by Alan Turing - operational way
Church-Turning hypothesis/thesis - what is computable is that computable via a Turing machine.
Here is the Python code [#5]
Here is the output of the Python code.
7. End of page