Download PYTHON PYTHON'S COMPANION, A STEP BY STEP GUIDE FOR BEGINNERS TO START CODING TODAY! PDF

TitlePYTHON PYTHON'S COMPANION, A STEP BY STEP GUIDE FOR BEGINNERS TO START CODING TODAY!
Author
TagsPython
LanguageEnglish
File Size10.8 MB
Total Pages-
Table of Contents
                            Introduction
An Overview of Python
Step 1: Installing Python
Installing Python in Windows
Which version should I use?
Installing Python in Mac
Running the Installation file
Starting Python
IDLE versus the command line interface (CLI)
IDLE
The Command Line Interface (CLI)
Different ways to access Python’s command line
If you’re using Windows
If you’re using GNU/Linux, UNIX, and Mac OS systems
Step 2: Working with IDLE
The Python Shell
The File Menu
The Edit menu
The Shell Menu
The Debug Menu
The Options Menu
The Window Menu
The Help Menu
Writing your First Python Program
Accessing Python’s File Editor
Typing your code
Saving the File
Running the Application
Exiting Python
Step 3: Python Files and Directories
The mkdir() Method
The chdir() Method
The getcwd() Method
The rmdir() Method
Step 4: Python Basic Syntax
Python Keywords (Python Reserve words)
Python’s Identifiers
Five rules for writing identifiers
A Class Identifier
Naming Global Variables
Naming Classes
Naming Instance Variables
Naming Modules and Packages
Naming Functions
Naming Arguments
Naming Constants
Using Quotation Marks
Statements
Multi-line statements
Indentation
Comments
Docstring
Step 5: Variables and Python Data Types
Variables
Memory Location
Multiple assignments in one statement
Assignment of a common value to several variables in a single statement
Data Types
Boolean Data Type
Step 6: Number Data Types
Integers (int)
Normal integers
Octal literal (base 8)
Hexadecimal literal (base 16)
Binary literal (base 2)
Converting Integers to their String Equivalent
integer to octal literal
integer to hexadecimal literal
integer to binary literal
Floating-Point Numbers (Floats)
Complex Numbers
Converting From One Numeric Type to Another
To convert a float to a plain integer
To convert an integer to a floating-point number
To convert an integer to a complex number
To convert a float to a complex number
To convert a numeric expression (x, y) to a complex number with a real number and imaginary number
Numbers and Arithmetic Operators
Addition (+)
Subtraction (-)
Multiplication (*)
Division ( /)
Exponent (**)
Modulos (%)
Relational or Comparison Operators
Assignment Operators
= Operator
add and +=
subtract and -=
multiply and *=
divide and /=
modulos and %=
floor division and //=
Bill Calculator
Built-in Functions Commonly Used with Numbers
abs(x)
max()
min()
round()
Math Methods
Math.ceil(x)
Math.floor(x)
Math.fabs()
Math.pow()
Math.sqrt()
Math.log()
Step 7: Strings
Accessing Characters in a String
String Indexing
The Len() Function
Slicing Strings
Concatenating Strings
Repeating a String
Using the upper() and lower() functions on a string
Using the str() function
Python String Methods
The replace() method
Case Methods with String
Upper()
Lower()
Swapcase()
Title()
Count() method
The find() method
Isalpha()
Isalnum()
Isidentifier()
The join() method
Lstrip() method
Rstrip() method
Strip([chars])
Rfind() method
Index() method
Rindex() method
Zfill() method
Rjust() method
Ljust() method
Center() method
Endswith() method
Startswith() method
Iterating Through a String
Step 8: Output Formatting
The print() function
Using the str.format() method to format string objects
Other Formatting Options
'<'
'>'
'^'
'0'
'='
Step 9: Lists
Accessing Elements on a List
Indexing
Negative Indexing
Slcing Lists
Adding Elements to a List
Changing Elements of a List
Concatenating and Repeating Lists
Inserting Item(s)
Removing or Deleting Items from a List
Sorting Items on a List
Using the count() Method on Lists
Testing for Membership on a List
Using Built-in Functions with List
Len()
Max()
Min()
Sum()
Sorted()
List()
Enumerate()
List Comprehension
Step 10: Tuples
How to Create a Tuple
Accessing Tuple Elements
Indexing
Negative Indexing
Slicing a Tuple
Changing, Reassigning, and Deleting Tuples
Replacing a Tuple
Reassigning a Tuple
Deleting a Tuple
Tuple Membership Test
Python Tuple Methods
Count(x)
Index(x)
Built-in Functions with Tuples
Len()
Max()
Min()
Sorted()
Sum()
Tuple()
Enumerate()
Iterating through a Tuple
Tuples vs. Lists
Step 11: Sets
Creating a Set
Changing Elements on a Set
Removing Set Elements
Set Operations
Set Union
Set Intersection
Set Difference
Set Symmetric Difference
Set Membership Test
Using Built-in Functions with Set
Len()
Max()
Min()
Sorted()
Sum()
Enumerate()
Iterating Through Sets
Frozenset
Step 12: Dictionary
Accessing Elements on a Dictionary
Adding and Modifying Entries to a Dictionary
Removing or Deleting Elements from a Dictionary
The pop()method
The popitem() method
The clear() method
Other Python Dictionary Methods
Update(other)
Item() method
Values() method
Keys() method
Setdefault() method
Copy() method
The fromkeys() method
Dictionary Membership Test
Iterating Through a Dictionary
Using Built-in Functions with Dictionary
Lens()
Sorted()
Creating a Dictionary with the dict() function
Dictionary Comprehension
Step 13:Python Operators
Arithmetic Operators
Assignment Operators
Relational or Comparison Operators
Logical Operators
Identity Operators
Membership Operators
Bitwise Operators
Understanding the Base 2 Number System
Precedence of Operators
Step 14:Built-in Functions
The range() function
The input() Function
Password Verification Program
Using input() to add elements to a List
The print() Function
abs()
max()
min()
type()
Step 15: Conditional Statements
if statements
if…else statements
if…elif…else statements
nested if…elif…else statements
Step 16: Python Loops
The for Loop
For Loop with string:
For Loop with list
for loop with a tuple
Using for loop with the range() function
The While Loop
Break Statement
Continue Statement
Pass Statement
Looping Techniques
Infinite loops (while loop)
Loops with top condition (while loop)
Loops with middle condition
Loops with condition at the end
Step 17: User-Defined Functions
1. def keyword
2. function name
3. parameters
4. colon (:)
5. docstring
6. statement(s)
7. return statement
Calling a Function
Using functions to call another function
Program to Compute for Weighted Average
Anonymous Functions
Lambda functions with map()
Lambda functions with filter()
Recursive Functions
Scope and Lifetime of a Variable
Step 18: Python Modules
Importing a Module
Python’s Math Module
Displaying the Contents of a Module
Getting more information about a module and its function
The Random Module
Usage of Random Module
Random Functions
Universal Imports
Importing Several Modules at Once
Step 19: Date and Time
Formatted Time
Getting Monthly Calendar
The Time Module
The Calendar Module
calendar.firstweekday( )
calendar.isleap(year)
calendar.leapdays(y1, y2)
calendar.month(year, month, w=2, l=1)
calendar.monthcalendar(year, month)
calendar.monthrange(year, month)
calendar.prmonth(year, month, w=2, l=1)
calendar.setfirstweekday(weekday)
calendar.weekday(year, month, day)
Datetime
Step 20: Namespaces
Scope
Step 21: Classes and Object-Oriented Programming
Defining a Class
Creating an Object
The __init__() method
Instance Variables
Adding an attribute
Deleting Objects and Attributes
Modifying Variables within the Class
Inheritance
Multiple Inheritance
Multilevel Inheritance
Step 22: Python Iterators
Creating a Python Iterator
Step 23: Python Generators
Step 24: Files
The File Object Attributes
File Operations
The Open() function
Writing to a File
Closing a File
Opening, Writing to, and Closing a Text File
Reading a Python File
The readlines() method
Line by Line Reading of Text Files with the ‘while’ loop
Line by Line Reading of Text Files using an Iterator
The ‘with statement’
Appending Data to a File
Renaming a File
The rename() method
Deleting a File
Binary Files
File Methods
File.writer(str)
File.writelines(sequence)
File.readline(size)
File.readlines()
File Positions: file.tell() and file.seek
File.tell()
File.seek()
File.read(n)
File.truncate([size])
File.flush()
File.close()
File.isatty()
File.fileno()
Step 25: Handling Errors or Exceptions
Syntax Errors
Runtime Errors
Built-in Exceptions
Catching Exceptions
try and except
try...finally
Python Cheat Sheets
Variable Assignment
Accessing Variable Values
Python Operators
Arithmetic Operators
Assignment Operators
Relational Operators
Logical Operators
Identity Operators
Membership Operators
Bitwise Operators
Strings
Lists
Tuple
Dictionary
Sets
Loops
Conditional Statements
if…else
if…elif…else
Built-in Functions
User-Defined Functions
Classes
Files
Text File Opening Modes
Binary File Opening Mode
File Operations
Date and Time
Python Modules
Help!
Google
FAQ
IRC (Internet Relay Chat)
Other Best Selling Books You Might Like!
Conclusion
                        

Similer Documents