Basics of Python Programming - 2nd Edition : Learn Python in 30 days (Beginners approach)
โ Scribed by Guleria, Pratiyush;
- Publisher
- BPB Publications
- Year
- 2024
- Tongue
- English
- Leaves
- 246
- Edition
- 2
- Category
- Library
No coin nor oath required. For personal study only.
โฆ Synopsis
Mastering the Python fundamentals with practical examples
KEY FEATURES
โ The book takes a beginner-friendly approach with practical examples, multiple choice questions, and solved exercises to help readers understand Python better.
โ The book maintains clear explanations with concise chapters, making it suitable for those new to programming.
โ This edition also covers NumPy for array manipulations and complex problem-solving. It teaches how to use Tkinter to create user-friendly applications with interactive interfaces.
DESCRIPTION
The basics of Python are the book's main focus. With practical examples, students will understand the fundamentals of Python. This book is designed in a way that should make every example understandable to the readers. In addition, from the perspective of a competitive examination, the book offers multiple-choice questions, true/false questions, and practical solved exercises.
Through this book, the readers will be able to learn Python basics. This includes setting up your environment and manipulating data. Additionally, they will also learn how to master control flow with conditional statements and loops for more responsive programs and utilize functions for organizing code and file handling to work with local data. Learners will also explore object-oriented programming (OOP) and essential libraries like NumPy for advanced programming.
This edition brings a new horizon of NumPy and Tkinter for numerical computing tasks like array manipulations, tackling complex problems, and building user-friendly applications with interactive graphical interfaces, respectively.
From every chapter, the reader will learn the programming fundamentals and will be able to execute the programs on their own.
WHAT YOU WILL LEARN
โ Install and run Python programs, understand variables, user input, and operators.
โ Organize code and improve reusability by defining and using functions.
โ Store and manage data efficiently using lists, tuples, and dictionaries.
โ Organize data effectively using iterators and generators for memory optimization.
โ Gracefully handle errors and exceptions to improve program robustness.
WHO THIS BOOK IS FOR
This book is intended for students who are new to the study of Python. Additionally, it benefits those enrolled in diploma-level studies or pursuing undergraduate studies or a master's degree at state universities or colleges.
โฆ Table of Contents
Cover
Title Page
Copyright Page
Dedication Page
About the Author
About the Reviewers
Acknowledgement
Preface
Table of Contents
1.โIntroduction to Python Variables, Datatypes and Operators
Introduction
Structure
Objectives
Python installation
Exploring Python
Example 1.1: Program to print Hello World
Variable declaration and getting user input in Python
Example 1.2: Example of user input
Example 1.3: Addition of two numbers
Example 1.4: Write a program to swap two values
Python datatypes
Example 1.5: Example of integer, float, string datatypes, and type conversion
Operators in Python
Example 1.6: Arithmetic operators in Python
Relational operators
Example 1.7: Relational operators in Python
Logical, bitwise and assignment operators
Example 1.8 Example of logical, bitwise, left shift, right shift and assignment operators
Identity operators
Example 1.9: Example of is and isnot identity operator
Membership operators
Example 1.10: Using the membership operator
Precedence of operators
type() function in Python
Example 1.11: Write a program for the type() function
Conclusion
Points to remember
Exercises
2.โConditions and Loops
Introduction
Structure
Objectives
If condition
Example 2.1: Example of if condition
Example 2.2: Example of if condition using and, or operators
Example 2.3: Example of checking conditions using and, or operators
Nested-if condition
Example 2.4: Example of nested-if conditions to find the greatest of three numbers
Loops
Example 2.5: Example of a while loop
Example 2.6: Sum of first five numbers using the while loop
Example 2.7: Demonstrating break statement in a while loop
Example 2.8: Example for finding a palindrome number using a while loop
Example 2.9: Multiplication of a number using a while loop
Example 2.10: Example of for loop
Example 2.11: Example of the list and for loop
Example 2.12: Print the numbers using range() function in for loop
Example 2.13: Write a program to display odd numbers using for loop
Example 2.14: Write a program using for loop with arrays
Example 2.15: Find the factorial of a number using for loop
Example 2.16: Program to find the sum of all numbers stored in a list using for loop
Example 2.17: Finding prime number taking input from the user
Break and continue statement
Example 2.18: Write a program to display the prime numbers from 1 to 20 using for loop
Conclusion
Questions
Points to remember
3.โArrays and Functions
Introduction
Structure
Objectives
Arrays
Example 3.1: Write a program for arrays using append() function
Example 3.2: Example of membership operator in
Example 3.3: Example of in operator and if condition
Example 3.4: Example of len() function in array
Example 3.5: Display values from 0 to 9 using for loop
Example 3.6: Display values from 0 to 9 using arrays and append() function
Functions
Example 3.7: Passing parameters in a function
Local and global variables in functions
Example 3.8: Local and global variable
Example 3.9: Write a program for a variable having global scope
Example 3.10: Write a calculator program using the concept of functions
Example 3.11: Function returning the absolute value of a number
Example 3.12: Write a program to sort array elements
Example 3.13: Write a program to find the square of a number using functions
Lambda function
Example 3.14: Adding numbers using the lambda function
Conclusion
Points to remember
Exercises
4.โLists, Tuples, Iterators Generators, and Sets
Introduction
Structure
Objectives
Lists
Example 4.1: Example of using the append() function in lists
Slicing
Example 4.2: Example of slicing a list and for storing multiple data items
Example 4.3: Example of Slicing using double colon for list sequences
Tuples
Example 4.4: Example for concatenation of tuples
Example 4.5: Nested tuples
Python iterators
Example 4.6: Write a program to print a list of courses using iterators
Example 4.7: Write a program using iterators through loops
Python generators
Example 4.8: Write a program for generators
Example 4.9: Simplify the Example 4.8 using loops
Sets
Example 4.10: Example of a set and its operations
Conclusion
Points to remember
Exercises
5.โDictionaries and Modules
Introduction
Structure
Objectives
Dictionaries in Python
Example 5.1: Write a program for the dictionary
Example 5.2: Accessing values in a dictionary using index and arrays
Example 5.3: Dictionary example for addition and deletion of key-value pairs
Nested dictionary
Example 5.4: Example of nested dictionary
Example 5.5: Counting the number of digits, lowercase, uppercase, and vowels in a sentence
pop() method in a dictionary
Example 5.6: Example of pop() method in dictionary
Modules
Example 5.7: Using modules
Example 5.8: Example of using dictionary using modules
Example 5.9: Example of importing mathematical functions in a module
Conclusion
Points to remember
Exercises
6.โFile Handling and Databases
Introduction
Structure
Objectives
File and modes used in file handling
Example 6.1: Example for reading a file
Example 6.2: Example for reading every line of the file
Example 6.3: Write data into file using w mode
Example 6.4: Write a program to illustrate append mode
Databases
Data definition language
Data query language
Data manipulation language
Data control language
Transaction control language
Example 6.5: Write a program for database and table creation
Example 6.6: Program to insert a record into a table
Example 6.7: To read records from the table and display them
Example 6.8: Write a program to update the data
Example 6.9: Write a program to delete the data
Conclusion
Points to remember
Exercises
7.โObject-Oriented Programming
Introduction
Structure
Objectives
Classes and objects
Example 7.1: Writing a program for class and objects
Example 7.2: Writing a program for functions in a class
Inheritance
Example 7.3: Writing a program for inheritance
Overriding
Example 7.4: Writing a program for overriding
Example 7.5: Write a program for inheritance and function overriding
Encapsulation
Example 7.6: Write a program for encapsulation restricting access to the private variables
Example 7.7: Write the aforementioned example using public access specifier
Conclusion
Points to remember
Exercises
8.โRegular Expressions, Date and Time
Introduction
Regular expression for pattern matching
Example 8.1: Write a program for substring function using regular expression
Example 8.2: Regular expression program to search string
Example 8.3: Write a program to check email ID pattern using the function
Example 8.4: Write a program for validating string values only
Example 8.5: Write a program for validating numerical values only
Example 8.6: Regular expression to validate the mobile number digits
Date and time functions
Example 8.7: Write a program to display time
Example 8.8: Write a program to display datetime using now function
Example 8.9: Write a program to obtain the calendar month using calendar module
Conclusion
Points to remember
Exercises
9.โException Handling
Introduction
Objectives
Exception
Example 9.1: Program of exception error occurred due to inappropriate values
Example 9.2: Program of exception error raised due to different data types
Example 9.3: Program of IOError exception
Example 9.4: Program of ModuleNotFound exception
Example 9.5: Write a program for division by zero exception
Example 9.6: Example of assert statement for exception handling
Conclusion
Points to remember
Exercises
10.โNumPy and TKinter
Introduction
Structure
Objectives
1-D array operations using NumPy
Example 10.1: Write a program to create a simple 1D array from a Python list
Example 10.2: Finding sum, mean, max, and min functions using NumPy
Matrix addition and multiplication using NumPy
Example 10.3: Write a program for matrix addition and multiplication using NumPy
Fundamentals of Tkinter main application window
Example 10.4: Example of Tkinter application window
Label and button widget in Tkinter
Example 10.5: Create a label and button widget in Tkinter
Button click event and input from user in Tkinter
Example 10.6: Example of button click event
Example 10.7: Example of taking input from a user using the text field
Example 10.8: Write a program for performing arithmetic operations
Conclusion
Points to remember
Exercises
Appendix: Practice Exercises with Solutions
Sample programs
Output prediction
Multiple choice questions
Fill in the blanks
True/False
๐ SIMILAR VOLUMES
<p>Welcome to this training for the Kindle book Python Programming for Learn the Fundamentals of Python in 7 Days. Through this book, you are going to learn everything you need to know in order to start using Python in a way that is going to make your work more productive and valuable. Knowing how t
<p>Do you want to learn Python in a easy and fast way?</p><p>Learn Python Programming NOW!</p><p> Through this book, you are going to learn everything you need to know in order to start using Python in a way that is going to make your work more productive and valuable.ย </p><p>Knowing how to use Pyt
<h2><span>The world of Python programming is booming! Get a slice of the action.</span></h2><p><span>Have you always wanted to be a part of the programming world, but things seem confusing and complicated so youโve never gone through with it? </span></p><p><span>Are you hoping to get a career in pro
<span>I want to thank you and congratulate you for purchasing the book, โLearn to Use Python in Hacking for Beginners in 7 Daysโ.<br>This book has actionable information on how to start using python for hacking in as little as 7 days.<br>According to a report (that entailed Statistics of Web Attacks