New PDF release: Python Programming: An Introduction to Computer Science

By John Zelle

ISBN-10: 1887902996

ISBN-13: 9781887902991

This e-book is designed for use because the fundamental textbook in a college-level first direction in computing. It takes a reasonably conventional technique, emphasizing challenge fixing, layout, and programming because the center talents of computing device technology. besides the fact that, those principles are illustrated utilizing a non-traditional language, specifically Python.

Although i exploit Python because the language, educating Python isn't the major element of this publication. really, Python is used to demonstrate basic rules of layout and programming that follow in any language or computing surroundings. In a few locations, i've got purposely kept away from yes Python positive aspects and idioms that aren't as a rule present in different languages. There are already many strong books approximately Python out there; this booklet is meant as an advent to computing.

Features contain the subsequent: *Extensive use of special effects. *Interesting examples. *Readable prose. *Flexible spiral assurance. *Just-in-time item assurance. *Extensive end-of-chapter difficulties.

Show description

Read Online or Download Python Programming: An Introduction to Computer Science PDF

Best introductory & beginning books

Download e-book for iPad: Introduction to 80X86 Assembly Language and Computer by Richard C. Detmer

A working laptop or computer should be seen from many various degrees, and used for lots of varied capabilities, resembling the production of latest software software program. despite the fact that, a precise desktop works at a fair reduce point than this. advent to 80x86 meeting Language and desktop structure divides its emphasis among the assembly-language/machine-language point of computing device operations and the architectural point, that's, the extent outlined by way of the computing device directions that the processor can execute.

Download PDF by Jr. Jerry Lee Ford: Ruby Programming

Ruby is a loose and robust programming language that may be used to boost courses to fulfill approximately any programming problem, together with scripting, software programming and internet improvement. This new textual content teaches Ruby programming via a full of life hands-on method and attention on online game improvement. scholars commence by way of studying the basics of machine programming and may flow directly to gaining knowledge of the options and ideas serious about Ruby programming.

Extra resources for Python Programming: An Introduction to Computer Science

Sample text

Py def main(): n = input("Please enter a whole number: ") fact = 1L # Use a long int here for factor in range(n,0,-1): fact = fact * factor print "The factorial of", n, "is", fact Now we can take the factorial of arbitrarily large inputs. main() Please enter a whole number: 100 The factorial of 100 is 933262154439441526816992388562667004907159682 643816214685929638952175999932299156089414639761565182862536979208272 23758251185210916864000000000000000000000000 34 CHAPTER 3. 0), these answers will be printed with an “L” appended.

Can you see why? Python evaluates this expression by first trying to calculate 2 ** 31. That calculation produces the error before Python has a chance to subtract one. We need to be a little cleverer and sneak up on the value from underneath. We can use the fact that 231 230 230 . Strategically subtracting one from each side gives us 231 1 230 1 230. By subtracting one in the middle of the computation, we can ensure that the intermediate value never gets bigger than the final result. Here’s what Python says: ✂ ✂ ✂ ✂ >>> 2 ** 30 - 1 + 2 ** 30 2147483647 By the way, this expression illustrates another way that Python ints differ from the integers that they represent.

Obviously it depends on how much money we start with (the principal) and how much interest the account earns. Given the principal and the interest rate, a program should be able to calculate the value of the investment ten years into the future. We continue by developing the exact specifications for the program. Recall, this is a description of what the program will do. What exactly should the inputs be? We need the user to enter the initial amount to invest, the principal. We will also need some indication of how much interest the account earns.

Download PDF sample

Python Programming: An Introduction to Computer Science by John Zelle

by Richard

Rated 4.22 of 5 – based on 43 votes