Python Bookcamp

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Vaskaran Sarcar
Year: 2021

Language: English
Pages: 360

About the Author
Acknowledgments
Preface
Chapter 1: Getting Ready for Program Execution
Overview
Setting Up the Programming Environment
Using Command Prompt
Using IDLE
Using PyCharm IDE
Executing Simple Programs
Demonstration 1
Output
Demonstration 2
Output
Demonstration 3
Output
Chapter 2: Comments, Variables, and Operators
Using Comments
Demonstration 1
Output
Analysis
Introduction to Variables
Strings vs Numbers
int vs float
Demonstration 2
Output
Analysis
Naming Conventions
Assigning Multiple Variables in a Single Line
Assigning Same Value to Multiple Variables
Operators
Arithmetic Operators
Assignment Operators
Comparison (or Relational) Operators
Logical Operators
Bitwise Operators
Precedence of Operators
Operators Associativity
Identity Operators
Membership Operators
Solution to Exercises
General Comments for Case Studies
Case Study I
Chapter 3: Common Data Types
Code Demonstrations with Strings
Code Demonstrations with Numbers
Quick talk on f-strings
Accepting User Inputs
Demonstration 1
Output
Solution to Exercises
CS 1.1 Implementation
Case Study II
Chapter 4: Decision Making
Using an if Statement
Demonstration 1
Output
Using the if-else Statements
Demonstration 2
Output
Demonstration 3
Output
Demonstration 4
Output
Using elif with an if-else Statement
Demonstration 5
Output
Demonstration 6
Output
Analysis
Tautology and Contradictions
Alternative Designs
Demonstration 7
Output
Analysis
Demonstration 8
Output
Solution to Exercises
CS 2.1 Implementation
Case Study III
Chapter 5: Iteration using Loops
The Purpose of Iteration
The while Loop
Demonstration 1
Output
Demonstration 2
Output
Analysis
The for Loop
Demonstration 3
Output
Analysis
Demonstration 4
Output
Analysis
Use of break Statement
Demonstration 5
Output
Analysis
Use of continue Statement
Demonstration 6
Output
Analysis
Nested Loop
Demonstration 7
Output
Analysis
Solution to Exercises
CS 3.1 Implementation
Case Study IV
Chapter 6: Advanced Data Types
Working with Lists
Working with Tuples
Working with Dictionaries
Working with Sets
Solution to Exercises
CS 4.1 Implementation
Possible improvements
Case Study V
Chapter 7: Functions and Modules
Function Overview
Demonstration 1
Output
Analysis
Argument vs Parameter
Discussion on Function Arguments
Positional Argument
Keyword Arguments
Use of Default Values
Demonstration 2
Output
Demonstration 3
Output
Analysis
Discussion on Return Values
Demonstration 4
Output
Demonstration 5
Output
Lambda Function
Demonstration 6
Output
Demonstration 7
Output
Modules
Demonstration 8
Output
Using Alias
Demonstration 9
Output
Demonstration 10
Output
Quick Discussion on pip
Solution to Exercises
CS 5.1 Implementation
Possible Improvements
CS 5.2 Implementation
Possible Improvements
Case Study VI
Chapter 8: Exception Management
Types of Mistakes
General Philosophy
Common terms
Python Exceptions
Demonstration 1
Case Study with Valid Inputs
Case Study with an Invalid Input
Case Study with another Invalid Input
Key Points of the Exception-handling Mechanism
Demonstration 2
Case Study with Valid Inputs
Case Study with an Invalid Input
Case Study with another Invalid Input
Demonstration 3
Case Study with Valid Inputs
Case Study with Invalid Inputs
Use of pass Statement
Demonstration 4
Case Study with Valid Inputs
Case Study with an Invalid Input
Analysis
Arranging Multiple except Blocks
Case Study with an Invalid Input
Case Study with another Invalid Input
Custom Exception
Demonstration 5
Output
Debugging Code Using assert Statement
Demonstration 6
Output
Demonstration 7
Output
Analysis
Solution to Exercises
CS 6.1 Implementation
Case Study VII
Chapter 9: Programming with Files
Reading from a File
Quick Talk about File Paths
Demonstration 1
Output
Analysis
Writing to a File
Demonstration 2
Output
Analysis
Alternative Way to Read and Write
Demonstration 3
Output
Analysis
Working with Binary Files
Demonstration 4
Output
Renaming and Removing Files
Demonstration 5
Output
Using with Keyword
Demonstration 6
Output for Approach1
Output for Approach2
Output for Approach3
Handling FileNotFoundError
Demonstration 7
Output
Analysis
Solution to Exercises
CS 7.1 Implementation
Chapter 10: Object-Oriented Programming Concepts
Class and Objects
Encapsulation
Abstraction
Inheritance
Polymorphism
Q&A Session
Case Study VIII
Chapter 11: Class, Objects, and Inheritance
Constructing the Building Blocks for OOP
Demonstration 1
Output
Analysis
Constructor
Demonstration 2
Output
Analysis
Looking into Instance Creation Process
Demonstration 3
Output
Analysis
Changing an Attribute Value
Demonstration 4
Output
Working with Default Attributes
Demonstration 5
Output
Analysis
Importing Classes
Demonstration 6
Output
Analysis
Demonstration 7
Output
Demonstration 8
Demonstration 9
Output
Use of Identity Operator
Demonstration 10
Output
Inheritance
Demonstration 11
Output
Analysis
Updated Implementation
Output
Demonstration 12
Output
Private Variables and Methods
Demonstration 13
Output
Analysis
Static Methods and Class Methods
Understanding the Difference
Demonstration 14
Output
Analysis
Solution to Exercises
CS 8.1 Implementation
Possible improvements
Chapter 12: Test Your Code
The Code for Testing
Testing Functions
Demonstration 1
Output
Demonstration 2
Output
Analysis
Testing Class
Demonstration 3
Output
Solution to Exercises
Index