n 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
Accessing Pythons File Editor
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
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)
Binary literal (base 2)
Converting Integers to their String Equivalent
integer to octal 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
Subtraction (-)
Multiplication (*)
Division ( /)
Exponent (**)
Modulos (%)
Relational or Comparison Operators
Assignment Operators
= Operator
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
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. Click to find out more A gide to cryptozoology pdf