Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Thomas Theis

Rating No ratings yet

If you want to program with Python, you’ve come to the right place! Take your first steps with this Python crash course that teaches you to use core language elements, from variables to branches to loops. Follow expert guidance to work with data types, functions, and modules—and learn how to manage errors and exceptions along the way. Apply Python programming to develop databases, graphical user interfaces, widgets, and more. Practice your skills with example exercises, and start developing your own applications with Python today! In this book, you’ll learn about: a. Language Basics Learn the Python fundamentals, from initial installation to running your first program. Master core concepts including variables, branching, loops, functions, and modules; then work with data types such as integers, strings, and tuples. b. Python in Practice Apply Python programming in key development scenarios. Use Python for object-oriented programming, create and identify threads, manage files and directories, develop databases with SQLite and MySQL, and more. c. Example Exercises Get hands-on experience with practical programming exercises. Follow along with a game development example as you move from chapter to chapter. You’ll be ready to create your own applications with Python in no time! Highlights include: 1) Installation 2) Python language basics 3) Object-oriented programming 4) Error handling 5) Data types 6) Multithreading 7) File processing 8) Databases 10) GUI programming 11) PyQt 12) Example exercises

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A hands-on crash course that takes you from installing Python to building small applications with databases, GUIs, and threads. Best for absolute beginners and self-taught learners who want a single guided path with exercises rather than a reference tome. 【Book Arc】 - **Opening (~0%–12%)**: Environment setup, running your first program, and why Python dominates industry; then variables, numeric types, and the floating-point precision caveat you must internalize early. - **Early (~12%–31%)**: Control flow through branching, loops, and operator precedence, illustrated by small games; then functions, modules, and the core data structures (strings, lists, tuples, dictionaries) plus the identity-vs-equality distinction. - **Middle (~31%–54%)**: Standard library and formatting work — print/format options, math and random modules, custom modules, command-line parameters — followed by object-oriented programming with inheritance, then dates, queues, collections, and multithreading with shared data. - **Late (~54%–end)**: Applied topics: file and directory handling with open modes and seek/close discipline, databases via SQLite and MySQL, and GUI development with PyQt widgets. - **Ending**: A running game-development example threaded across chapters, plus larger practice programs (e.g., a fractions-training exercise) that combine branches, loops, exceptions, tuples, and multi-return functions. 【Key Takeaways】 - **Floating-point numbers are not mathematically exact** (Opening): the book shows a miles-to-kilometers conversion producing a stray digit at the 16th decimal place, and warns this limitation resurfaces throughout — plan to round for display. (Opening) - **Identity and equality are different questions** (Early): `is` checks whether two names reference the same object, `==` checks content; the book demonstrates this with numbers, strings, and lists, where reassignment versus mutation behave differently. (Early) - **Modularization pays off as programs grow** (Early): functions and modules let you define reusable parts once, share them across programs, and keep maintenance tractable — the stated rationale for splitting code early rather than later. (Early) - **Dictionaries are unordered key-value stores** (Early): created with curly braces, compared only by `==`/`!=` on matching pairs, and accessed by key; the book walks through adding, replacing, deleting, and updating entries. (Early) - **Object orientation is taught as specialization** (Middle): a base `Vehicle` class passes properties and methods to a derived `Car` class via inheritance and `super()`, with constructors, destructors, and `__dict__` used for data exchange such as JSON. (Middle) - **Threads share global state, which is both the point and the hazard** (Middle): subthreads access and mutate the main thread's globals, and thread IDs let you observe parallel execution — the book demonstrates the mechanism without dwelling on synchronization. (Middle) - **File handling demands discipline** (Late): opening modes (`a+`, binary `b`) and the access position controlled by `seek()` matter, and files must be closed or they may be blocked from further access. (Late) - **The book closes the loop with integrated practice** (Ending): a fractions-training program with three difficulty levels and a chapter-spanning game example show how branches, loops, exceptions, tuples, and multi-return functions combine in real code. (Ending) 【Reading Tips】 - Deep-read the early chapters on variables, floating-point behavior, and identity vs. equality — these are the conceptual traps that cause silent bugs later. - Skim the standard-library catalog sections (math, random, time, collections) on a first pass, then return when a project actually needs them. - Treat the larger example programs (fractions training, the game) as integration checkpoints: attempt them before reading the solution to test whether the earlier chapters stuck. - For the applied chapters (files, databases, PyQt), type the examples rather than reading them — GUI and database code rarely makes sense passively. - Keep the operator-precedence and built-in function tables as quick references; they are lookup material, not memorization material. 【Coverage Limits】 This guide is based on stratified excerpts covering roughly the first half of the book in detail, with later chapters (files, databases, GUI/PyQt) represented mainly by section headings and brief fragments. Specific later-chapter examples, database schemas, and PyQt widget walkthroughs are not covered in the excerpts.
Page 14
es 5.8.5   Signal Processing 5.8.6   Statistics Functions 5.9   Custom Modules 5.9.1   Creating Custom Modules 5.9.2   Standard Import of a Module 5.9.3   Im...
View in text
Excerpt 2
operator. In our example, the two parameters and the return value are supposed to have the float type. Only the function header has been changed. Calling the...
View in text
Excerpt 3
print("same content:", x == y) y = ["abc",12.8,"xyz"] print("same object:", x is y) Listing 4.35     reference.py File The following output is generated: Num...
View in text
Excerpt 4
is output in the destructor method defined in this example. This method is called using the del 6.2    Advanced Topics A class can pass its properties and me...
View in text
Excerpt 5
n found = False for i in range(len(hs_list)): if difference < hs_list[i][1]: hs_list.insert(i, [name, difference]) found = True break if not found: hs_list.a...
View in text
Excerpt 6
he window can be enlarged or reduced within defined values. import tkinter window = tkinter.Tk() window.title("GUI") window.geometry("300x225") window.minsiz...
View in text
Excerpt 7
color and a size can be selected in this way. import PyQt6.QtWidgets as wi import sys class Window(wi.QWidget): def __init__(self): super().__init__() gr = w...
View in text
Excerpt 8
ction 7.2] round() [→ Section 4.1] Rounding [→ Section 4.1] Runtime error [→ Section 5.5] [→ Section 5.5] RuntimeError [→ Section 5.5] rwx [→ Section A.4] S ...
View in text
Tags
AI categories
PythonProgramming LanguageEducation
ISBN: 1493225863
Publisher: Rheinwerk Verlag
Publish Year: 2024
Language: English
Pages: 437
File Format: PDF
File Size: 4.7 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…