Learning Scientific Programming with Python (2nd edition)
Examples
- E2.1: Numbers in the Python shell
- E2.2: Simple mathematical expressions
- E2.3: Heron's formula
- E2.4: Python's type and id built-ins
- E2.5: The return values of logic expressions
- E2.6: The "is not" operator
- E2.7: Integer object identity gotcha
- E2.8: String concatenation with + and *
- E2.9: String escaping
- E2.10: Unicode
- E2.11: String slicing
- E2.12: String striding
- E2.13: String methods
- E2.14: A simple text table using Python strings
- E2.15: String representation of integers with comma-separated thousands
- E2.16: Using a Python list as a stack
- E2.17: Splitting a string
- E2.18: Assigning multiple variables in one statement
- E2.19: The string join method
- E2.20: The Fibonacci sequence
- E2.21: The Gregorian calendar
- E2.22: Euclid's algorithm for finding the gcd of a number
- E2.23: A simple "turtle"
- E2.24: Writing numbers to a file
- E2.25: Reading numbers from a file
- E2.26: Assigning a variable name to a function
- E2.27: Default arguments to functions
- E2.28: Function Scope
- E2.29: The Lazy Caterer's sequence
- E2.30: The Tower of Hanoi