3. Introduction to basic Python constructions¶
This section contains an introduction to some basic programming concepts, and the basic Python constructions that implement them. It is intended primarily for those with no programming background, but there are fine points (such as the list comprehension section) which should be of help to any newcomer to Python.
What we know so far:
Some types that can be data and contain data
Some ways to put data in containers and take it out
What we can’t do yet:
Branch: do different things depending on current conditions, including current data item;
Do things over and over, as a way of computing complex things;
Package things up into reusable code.
Contents
- 3.1. If-then construction (Conditionals)
- 3.2. Operators that return Boolean results
- 3.3. How Boolean tests work
- 3.4. Loops
- 3.5. List comprehension
- 3.6. Functions
- 3.7. Functions, loops, and types assignment
- 3.8. Nims assignment
- 3.9. Combination
- 3.10. Recursion (advanced)
- 3.11. Student scholarship problem
- 3.12. Permutation (advanced)
- 3.13. Summary
- 3.14. Midterm