Send
Close Add comments:
(status displays here)
Got it! This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website. nbsp; Note: This appears on each machine/browser from which this site is accessed.
Code and data driven programming
c
go
java
js
lua
py
vbs
rkt
scm
pro
1. Code and data driven programming
2. Code driven programming
Code-drive programming involving control flow uses program code to achieve an effect.
3. Data driven programming
Data-driven programming (sometimes involving data flow) uses data to help achieve an effect.
4. 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.
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.
Here is the output of the Python code.
5. Arithmetic operations
Consider the evaluation of arithmetic operations.
Here is the Python code.
Here is the output of the Python code.
6. 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.
Here is the output of the Python code.
7. 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.
Here is the output of the Python code.
8. End of page
9. Multiple choice questions for this page
1 questions omitted (login required)