An Introduction to Python and Computer Programming by Yue Zhang (auth.)

By Yue Zhang (auth.)

This publication introduces Python programming language and primary innovations in algorithms and computing. Its audience contains scholars and engineers with very little heritage in programming, who have to grasp a pragmatic programming language and examine the elemental pondering in machine science/programming. the most contents come from lecture notes for engineering scholars from all disciplines, and has got excessive rankings. Its fabrics and ordering were adjusted time and again in keeping with lecture room reception. in comparison to replacement textbooks available in the market, this booklet introduces the underlying Python implementation of quantity, string, record, tuple, dict, functionality, classification, example and module items in a constant and easy-to-understand manner, making task, functionality definition, functionality name, mutability and binding environments comprehensible inside-out. through giving the abstraction of implementation mechanisms, this booklet builds a great realizing of the Python programming language.

Show description

Read Online or Download An Introduction to Python and Computer Programming PDF

Best introductory & beginning books

PHP 6/MYSQL programming for the absolute beginner

When you are new to programming with Hypertext Preprocessor 6 and MySQL and are trying to find an exceptional advent, this can be the ebook for you. built through machine technology teachers, books within the for absolutely the newbie™ sequence train the rules of programming via easy video game production. you are going to collect the abilities that you simply desire for simpler programming purposes and should find out how those talents may be positioned to take advantage of in real-world situations.

Java Programming: From Problem Analysis to Program Design, 5th Edition

Designed for a primary laptop technological know-how (CS1) Java path, JAVA PROGRAMMING: FROM challenge research TO application layout 5e will inspire readers whereas construction a cornerstone for the pc technology curriculum. With a spotlight on readers' studying, this article methods programming utilizing the most recent model of Java, and contains up to date programming workouts and courses.

Java For Testers Learn Java fundamentals fast

This publication is for those that are looking to research Java. fairly humans on a staff that are looking to research Java, yet who aren't going to be coding the most Java program i. e. Testers, Managers, enterprise Analysts, entrance finish builders, Designers, and so on. in the event you already be aware of Java then this booklet will not be for you.

Additional info for An Introduction to Python and Computer Programming

Example text

2 in the previous chapter. On the bottom of the figure, the main hardware components are shown, which include the CPU, memory and devices. Among the three main components, the CPU is the most important; it carries out computer instructions, including arithmetic operations. The typical way in which arithmetic operations are executed is: the CPU takes the operands from the memory, evaluates the result by applying the operator on them, and then stores the result back into the memory. The memory can be regarded as a long array of information storage units.

The last command shows the identify of a new object, constructed by the evaluation of the expression 12345. It is different from that of x, because every time a literal is evaluated, a new object is constructed in the memory. Here is another example. >>> x =12345 >>> y=x > > > id ( x ) 2 The memory addresses in the examples below are unlikely to be reproduced when the examples are tried again, since the allocation of memory addresses is dynamic and runtime dependent. 2 The Underlying Mechanism 29 4462893976 > > > id ( y ) 4462893976 >>> x =12345 > > > id ( x ) 4462894072 > > > id ( y ) 4462893976 When x is assigned to the value 12345 the second time, the right hand side of the assignment statement is evaluated first, which leads to a new object having the value 12345 in the memory.

In fact, it is treated as an identifier, and hence Python tries to look for the objects that is associated with the name abc in the binding table, leading to a name error. The correct way to enter a string literal, as shown by the ‘abc’ example, is to include the quotations. Because of the extra layer of functionality, the input function offers more flexibility compared with the raw_input function. However, it can also cause unexpected errors if the user is not familiar with Python literals. From the programmer’s perspective, the possibility for the return value of a function to be an arbitrary type can also lead to difficulty in processing it.

Download PDF sample

Rated 4.62 of 5 – based on 31 votes