Fundamentals of Python programming. Examples and practice exercises
  • Za darmo

ebook Fundamentals of Python programming. Examples and practice exercises Lidia Stępień, Marcin R. Stępień, Hubert Dróżdż

Lidia Stępień, Marcin R. Stępień, Hubert Dróżdż
Wydawca: Uniwersytet Jana Długosza w Częstochowie
Rok wydania: 2024
Opis Spis treści Szczegóły Recenzje

Fundamentals of Python programming. Examples and practice exercises is a comprehensive guide to learning Python programming. Written by experienced educators Lidia Stępień, Marcin R. Stępień, and Hubert Dróżdż, this ebook offers a practical approach to the basics of Python programming. With its engaging content and clear explanations, this ebook is perfect for students starting their journey into computer science or anyone interested in developing their programming skills.



Published by Uniwersytet Jana Długosza w Częstochowie in 2024, this book aims to provide readers with the foundations of Python programming through discussions on essential constructs and data structures. The authors have carefully chosen examples to illustrate these concepts, ensuring that learners gain a strong understanding of the language's syntax and capabilities.



In addition to teaching Python fundamentals, this ebook also includes practice exercises for readers to reinforce their learning. Designed for both beginners and those with experience in programming, Fundamentals of Python programming is an essential resource for anyone looking to explore the world of Python. The book's clear explanations and practical examples make it easy to follow, regardless of your prior knowledge.



With its focus on code readability and concise syntax, Python is one of the most popular programming languages today. Used across various domains, from web development and data analysis to artificial intelligence and machine learning, Python's popularity continues to grow. The rich library base and large community make it an ideal choice for learners at all levels.



Fundamentals of Python programming is a valuable tool for those looking to expand their programming skills or simply explore the capabilities of this versatile language. By learning Python, readers gain transferable skills that can be applied in other programming languages as well. The ebook's practical approach ensures that learners are ready to tackle projects using Python-based software systems.



This work would not have been possible without the support and guidance of dr hab. Andrzej Zbrzezny prof. UJD, whose years of experience with students inspired this ebook. The authors are grateful for the opportunity to benefit from his extensive scientific knowledge and teaching expertise.



If you're interested in expanding your programming skills or looking for a practical guide to Python programming, Fundamentals of Python programming is an excellent choice. Available in both print and electronic formats, this ebook can be easily accessed through various platforms. Whether you prefer hard copy or digital format, download this ebook today and start exploring the world of Python.

Spis treści ebooka Fundamentals of Python programming. Examples and practice exercises

Contents
Preface 6
1 Introduction to Python 8
1.1 Installing Python 3 interpreter . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2 Python language - the basics . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3 Working with interpreter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.4 Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.5 Practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2 Basic programming constructs 24
2.1 Conditional statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.1.1 Simple conditional statement . . . . . . . . . . . . . . . . . . . . . 24
2.1.2 Conditional statement with else clause . . . . . . . . . . . . . . . . 26
2.1.3 Complete conditional statement . . . . . . . . . . . . . . . . . . . . 27
2.2 Match case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
2.3 Iteration statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.3.1 while loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.3.2 for loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.4 Practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.4.1 Conditional statement . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.4.2 Iteration instructions . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3 Strings 46
3.1 Basic info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
3.2 Indexes and substrings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.3 Chosen str class methods . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.4 String formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.5 Practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3
Contents 4
4 Functions 62
4.1 Function - general form . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4.2 Function arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
4.3 Function call . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
4.4 Practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5 Data Structures 73
5.1 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
5.1.1 Lists - basic information . . . . . . . . . . . . . . . . . . . . . . . . 73
5.1.2 Chosen list class methods . . . . . . . . . . . . . . . . . . . . . . 77
5.1.3 Program call arguments . . . . . . . . . . . . . . . . . . . . . . . . 82
5.2 Tuples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
5.3 Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5.3.1 Sets - the basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5.3.2 Chosen set class methods . . . . . . . . . . . . . . . . . . . . . . . 90
5.3.3 Frozen sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
5.4 Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
5.4.1 Creating a dictionary . . . . . . . . . . . . . . . . . . . . . . . . . 92
5.4.2 Adding and overwriting data in a dictionary . . . . . . . . . . . . . 94
5.4.3 Deleting elements from a dictionary . . . . . . . . . . . . . . . . . 95
5.4.4 Dictionary inbuilt methods . . . . . . . . . . . . . . . . . . . . . . 96
5.4.5 Named function arguments . . . . . . . . . . . . . . . . . . . . . . 98
5.5 Practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
5.5.1 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
5.5.2 Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
5.5.3 Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
5.5.4 Various tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6 Exception handling and working with files 107
6.1 Syntax errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
6.2 Exception handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.3 Working with files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
6.3.1 File opening modes . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
6.3.2 Selected methods for text file objects . . . . . . . . . . . . . . . . . 117
6.3.3 Examples of working with text files . . . . . . . . . . . . . . . . . . 120
6.4 Binary files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
6.4.1 Selected methods of binary file objects . . . . . . . . . . . . . . . . 128
6.5 Practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Contents 5
7 Object-oriented programming 134
7.1 Basic concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
7.1.1 Defining Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
7.1.2 Encapsulating names in a class . . . . . . . . . . . . . . . . . . . . 137
7.2 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
7.3 Static and class methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
7.4 Operator Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
7.4.1 Methods for comparing objects . . . . . . . . . . . . . . . . . . . . 148
7.4.2 Basic methods of binary operations . . . . . . . . . . . . . . . . . . 149
7.4.3 Right-side binary operations methods . . . . . . . . . . . . . . . . 150
7.4.4 Dual-argument methods with in place update . . . . . . . . . . . . 151
7.4.5 Other selected methods of action . . . . . . . . . . . . . . . . . . . 152
7.4.6 Example of class Vector . . . . . . . . . . . . . . . . . . . . . . . . 153
7.5 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
7.6 Serializing Python Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
7.7 Practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
8 Advanced Python Elements 166
8.1 List comprehension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
8.2 Anonymous functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
8.3 Enumerated types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
8.3.1 Class Enum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
8.3.2 IntEnum class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
8.3.3 Flag Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
8.3.4 Class IntFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
8.4 Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
8.4.1 Module itertools . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
8.5 Generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
8.6 Practice exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
8.6.1 Iterators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
8.6.2 Itertools module . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
8.6.3 Generator functions . . . . . . . . . . . . . . . . . . . . . . . . . . 206
8.6.4 Generator expressions . . . . . . . . . . . . . . . . . . . . . . . . . 206
8.6.5 Additional tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Bibliography 208

Szczegóły ebooka Fundamentals of Python programming. Examples and practice exercises

Wydawca:
Uniwersytet Jana Długosza w Częstochowie
Rok wydania:
2024
Typ publikacji:
Ebook
Język:
angielski
Format:
pdf
ISBN:
978-83-679-8415-7
ISBN wersji papierowej:
978-83-679-8415-7
Autorzy:
Lidia Stępień,Marcin R. Stępień,Hubert Dróżdż
Miejsce wydania:
Częstochowa
Liczba Stron:
208

Recenzje ebooka Fundamentals of Python programming. Examples and practice exercises

Średnia ocena

0.0
0 recenzji

  • Reviews (0)

@CUSTOMER_NAME@

@COMMENT_TITLE@

@COMMENT_COMMENT@

@COMMENT_AVATAR@

@CUSTOMER_NAME@

@AUTHOR_PROFILE@ @COMMENT_ISO_COUNTRY@ @VERIFY_PURCHASE@
@COMMENT_DATE@
@COMMENT_NO_APPROVE@

@COMMENT_COMMENT@

Reply
@COMMENT_AVATAR@

@CUSTOMER_NAME@

@AUTHOR_PROFILE@ @COMMENT_ISO_COUNTRY@ @VERIFY_PURCHASE@
@COMMENT_DATE@
@COMMENT_NO_APPROVE@

@COMMENT_COMMENT@

Reply

Na jakich urządzeniach mogę czytać ebooki?

Ikona ebooka Na czytnikach Kindle, PocketBook, Kobo i innych
Ikona komutera Na komputerach stacjonarnych i laptopach
Ikona telefonu Na telefonach z systemem ANDROID lub iOS
Ikona urządzenia elektroniczne Na wszystkich urządzeniach obsługujących format plików PDF, Mobi, EPub
  • Za darmo
0,00 zł