What do you think?
Rate this book
454 pages, Paperback
First published November 22, 2013
Introducing Python: Modern Computing in Simple Packages, Bill Lubanovic
SECOND EDITION:
Second edition, 2020, 597pp., ISBN 9781492051367
Errata:
p. 49 says 10**googol has 1000 zeroes. No, it has a googol (10**100) of zeroes.
2**(3**4) = 2**81
(2**3)**4 = 2**12
FIRST EDITION:
Introducing Python, Bill Lubanovic, 2015, 454pp. Dewey 005.133
This book is pretty good at getting you coding quickly.
PYTHON
We get examples like this:
cheeses = []
for cheese in cheeses:
print('This shop has some lovely', cheese)
break
else: # no break means no cheese
print('This is not much of a cheese shop, is it?')
(Chapter 4: Py Crust: Code Structures. p. 79 in 2015 edition.)
WARNING: INSTALLING AND RUNNING
The Anaconda installer doesn't support spaces in the file-path name. Instead of "Current User," install as root. The book doesn't warn you of that.
https://github.com/ContinuumIO/anacon...
Then, since the executable and your files aren't in your user directory, when you want to run one of your scripts from a Windows powershell, you have to
cd C:\ProgramData\Anaconda3
then you can enter
C:\ProgramData\Anaconda3> python test1.py
to run your 'test1' script, or whatever it may be.
The book doesn't tell you this.
Use Anaconda Navigator to open a Windows PowerShell: doing it from here activates the environment: necessary to get your scripts to run. The book doesn't say this.
https://www.anaconda.com/products/ind...
has tutorial and quick-start guide
docs.anaconda.com
https://anaconda.cloud/
https://anaconda.cloud/tutorials/gett...
MODULE SEARCH PATH?
We learn that Python looks for files to import based on a list "in the standard sys module." We don't learn where this module is. Chapter 5: Py Boxes: Modules, Packages, and Programs, p. 113 in the 2015 edition.
CAUTION
CODE SAMPLES from the book: the simple ones work. Those dependent on pulling datasets off the web do not work.
https://github.com/madscheme/introduc...
has code examples from the book.
ARITHMETIC: CAUTION
10^2 evaluates to 8.
It's 10**2 that gives 100.
ASSIGNMENT STATEMENTS VS. FUNCTIONS
b = 5
c = 15
a = b + c
a
gives 20. So far so good. Now, though, after
b = 6
a
gives 20.
It's not enough to change the variable values: you have to redefine the function to get its output to change, if reassigning values to variables. You have to again say
a = b + c
now
a
gives 21.
YOU HAVE TO EXPLICITLY
import math
before you can do calculations like
math.sqrt(2)
1.4142135623730951
(although Python can do
2**.5
to give
1.4142135623730951
without the math library.)
math.log(10)
2.302585092994046
math.log(100, 10)
2.0
math.e
2.718281828459045
For the square root of a negative number, you have to explicitly import the complex math library:
import cmath
Then you can do
cmath.sqrt(-1)
1j
However, Python can do all this without importing the cmath library:
Pretty close:
(-1)**.5
(6.123233995736766e-17+1j)
(math.e)**(complex(0, math.pi/2))
(6.123233995736766e-17+1j)
2.718281828459045**(complex(0, 3.141592653589793/2))
(6.123233995736766e-17+1j)
x = complex(1, 1)
x**2
2j
2j**.5
(1.0000000000000002+1.0000000000000002j)
recommends
PYTHON FOR DATA ANALYSIS, WES MCKINNEY
Python Standard Library online documentation:
https://docs.python.org/3/library/
The Python Standard Library by Example, Doug Hellmann
https://doughellmann.com/books/the-py...
Open-source Python software:
https://pypi.org/
https://github.com/python
https://readthedocs.org/
https://code.activestate.com/
Introducing Python: Modern Computing in Simple Packages, Bill Lubanovic
SECOND EDITION:
Second edition, 2020, 597pp., ISBN 9781492051367
Errata:
p. 49 says 10**googol has 1000 zeroes. No, it has a googol (10**100) of zeroes.
2**(3**4) = 2**81
(2**3)**4 = 2**12
FIRST EDITION:
Introducing Python, Bill Lubanovic, 2015, 454pp. Dewey 005.133
This book is pretty good at getting you coding quickly.
PYTHON
We get examples like this:
cheeses = []
for cheese in cheeses:
print('This shop has some lovely', cheese)
break
else: # no break means no cheese
print('This is not much of a cheese shop, is it?')
(Chapter 4: Py Crust: Code Structures. p. 79 in 2015 edition.)
WARNING: INSTALLING AND RUNNING
The Anaconda installer doesn't support spaces in the file-path name. Instead of "Current User," install as root. The book doesn't warn you of that.
https://github.com/ContinuumIO/anacon...
Then, since the executable and your files aren't in your user directory, when you want to run one of your scripts from a Windows powershell, you have to
cd C:\ProgramData\Anaconda3
then you can enter
C:\ProgramData\Anaconda3> python test1.py
to run your 'test1' script, or whatever it may be.
The book doesn't tell you this.
Use Anaconda Navigator to open a Windows PowerShell: doing it from here activates the environment: necessary to get your scripts to run. The book doesn't say this.
https://www.anaconda.com/products/ind...
has tutorial and quick-start guide
docs.anaconda.com
https://anaconda.cloud/
https://anaconda.cloud/tutorials/gett...
MODULE SEARCH PATH?
We learn that Python looks for files to import based on a list "in the standard sys module." We don't learn where this module is. Chapter 5: Py Boxes: Modules, Packages, and Programs, p. 113 in the 2015 edition.
CAUTION
CODE SAMPLES from the book: the simple ones work. Those dependent on pulling datasets off the web do not work.
https://github.com/madscheme/introduc...
has code examples from the book.
ARITHMETIC: CAUTION
10^2 evaluates to 8.
It's 10**2 that gives 100.
ASSIGNMENT STATEMENTS VS. FUNCTIONS
b = 5
c = 15
a = b + c
a
gives 20. So far so good. Now, though, after
b = 6
a
gives 20.
It's not enough to change the variable values: you have to redefine the function to get its output to change, if reassigning values to variables. You have to again say
a = b + c
now
a
gives 21.
YOU HAVE TO EXPLICITLY
import math
before you can do calculations like
math.sqrt(2)
1.4142135623730951
(although Python can do
2**.5
to give
1.4142135623730951
without the math library.)
math.log(10)
2.302585092994046
math.log(100, 10)
2.0
math.e
2.718281828459045
For the square root of a negative number, you have to explicitly import the complex math library:
import cmath
Then you can do
cmath.sqrt(-1)
1j
However, Python can do all this without importing the cmath library:
Pretty close:
(-1)**.5
(6.123233995736766e-17+1j)
(math.e)**(complex(0, math.pi/2))
(6.123233995736766e-17+1j)
2.718281828459045**(complex(0, 3.141592653589793/2))
(6.123233995736766e-17+1j)
x = complex(1, 1)
x**2
2j
2j**.5
(1.0000000000000002+1.0000000000000002j)
recommends
PYTHON FOR DATA ANALYSIS, WES MCKINNEY
Python Standard Library online documentation:
https://docs.python.org/3/library/
The Python Standard Library by Example, Doug Hellmann
https://doughellmann.com/books/the-py...
Open-source Python software:
https://pypi.org/
https://github.com/python
https://readthedocs.org/
https://code.activestate.com/