Wednesday, September 24, 2008

Chapter 2

Chapter 2 involves using numbers. The great thing about Python that I have noticed is that, if you don't know what type of number it is, then it will report back to you what type it is. I tested this out by trying out some types:
type(1)

type(99999999999)

type(4.0)

I wanted to create an imaginary number and it ended up being real simple. All you do is type the equation you would see on a test:

12j +1
(1+12j)

If you want to print out the format specifiers in Python, you can put % in front of it.

print "Lets print out the format specifier %%D"
'Lets print out the format specifier %D'

A cool feature I noticed with Python is that when you do math and get an answer like 300.666666667, when you print this answer it will come out precise like 300.67.
Python is neat along the lines of, if you have a math problem to do, you can type it in exactly how it looks and it will process the answer for you. 

The exercises at the end of the book are helpful with applying all the great features of numbers in Python.


1 comment:

Dr. P said...

Did we ever get a schedule posted? If not, please update one and post it to the blog.

It's important so that we can keep track of our combined progress.