0% found this document useful (0 votes)
15 views80 pages

Python Java SQL Javascript The Ultimate Crash Course For Beginners To Master The 4 Most Indemand Programming Languages Stand Out From The Crowd and Find Highpaying Jobs Philip Robbins Instant Download

The document is a comprehensive guide titled 'Python, Java, SQL, and JavaScript: The Ultimate Crash Course for Beginners' by Philip Robbins, aimed at helping beginners master four in-demand programming languages. It covers foundational concepts, programming techniques, and advanced topics in each language, along with practical exercises. Additionally, it includes legal and disclaimer notices regarding the content's use and distribution.

Uploaded by

benonitetour
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views80 pages

Python Java SQL Javascript The Ultimate Crash Course For Beginners To Master The 4 Most Indemand Programming Languages Stand Out From The Crowd and Find Highpaying Jobs Philip Robbins Instant Download

The document is a comprehensive guide titled 'Python, Java, SQL, and JavaScript: The Ultimate Crash Course for Beginners' by Philip Robbins, aimed at helping beginners master four in-demand programming languages. It covers foundational concepts, programming techniques, and advanced topics in each language, along with practical exercises. Additionally, it includes legal and disclaimer notices regarding the content's use and distribution.

Uploaded by

benonitetour
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 80

Python Java Sql Javascript The Ultimate Crash

Course For Beginners To Master The 4 Most


Indemand Programming Languages Stand Out From
The Crowd And Find Highpaying Jobs Philip
Robbins download
https://ebookbell.com/product/python-java-sql-javascript-the-
ultimate-crash-course-for-beginners-to-master-the-4-most-
indemand-programming-languages-stand-out-from-the-crowd-and-find-
highpaying-jobs-philip-robbins-55838516

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Coding For Absolute Beginners Master The Basics Of Computer


Programming With Python Java Sql C C C Html And Css Andrew Warner

https://ebookbell.com/product/coding-for-absolute-beginners-master-
the-basics-of-computer-programming-with-python-java-sql-c-c-c-html-
and-css-andrew-warner-34095186

Computer Programming Allinonecoding For Beginners A Stepbystep Guide


To Learn Python Java Sql C C C Html And Css From Scratch Michail
Klling

https://ebookbell.com/product/computer-programming-allinonecoding-for-
beginners-a-stepbystep-guide-to-learn-python-java-sql-c-c-c-html-and-
css-from-scratch-michail-klling-55885230

Python Programming Javascript What Is Javascript Will Python Replace


Java Enter Into The Programming World With Python Training Lina Polly

https://ebookbell.com/product/python-programming-javascript-what-is-
javascript-will-python-replace-java-enter-into-the-programming-world-
with-python-training-lina-polly-232306760

Python Programming With The Java Class Libraries A Tutorial For


Building Web And Enterprise Applications With Jython 1st Edition
Richard Hightower

https://ebookbell.com/product/python-programming-with-the-java-class-
libraries-a-tutorial-for-building-web-and-enterprise-applications-
with-jython-1st-edition-richard-hightower-62157474
The Definitive Guide To Jython Python For The Java Platform
Description Based On Print Version Record Covers Jython 25cover
Includes Index Juneau

https://ebookbell.com/product/the-definitive-guide-to-jython-python-
for-the-java-platform-description-based-on-print-version-record-
covers-jython-25cover-includes-index-juneau-22003002

Programming In Two Semesters Using Python And Java Quentin Charatan

https://ebookbell.com/product/programming-in-two-semesters-using-
python-and-java-quentin-charatan-46494972

Java The Ultimate Guide To Learn Java And Python Programming Peter
Hoffman Stephen Hoffman

https://ebookbell.com/product/java-the-ultimate-guide-to-learn-java-
and-python-programming-peter-hoffman-stephen-hoffman-50199732

Traefik Api Gateway For Microservices With Java And Python


Microservices Deployed In Kubernetes 1st Edition Rahul Sharma

https://ebookbell.com/product/traefik-api-gateway-for-microservices-
with-java-and-python-microservices-deployed-in-kubernetes-1st-edition-
rahul-sharma-22075350

Java The Ultimate Guide To Learn Java And Python Programming Peter
Hoffman

https://ebookbell.com/product/java-the-ultimate-guide-to-learn-java-
and-python-programming-peter-hoffman-6769404
Python, Java, SQL and JavaScript
The Ultimate Crash Course for Beginners to Master
the 4 Most In-Demand Programming Languages,
Stand Out from the Crowd and Find High-Paying
Jobs

Philip Robbins
© Copyright 2024 - All rights reserved.
The content contained within this book may not be reproduced, duplicated
or transmitted without direct written permission from the author or the
publisher.
Under no circumstances will any blame or legal responsibility be held
against the publisher, or author, for any damages, reparation, or monetary
loss due to the information contained within this book. Either directly or
indirectly.

Legal Notice:
This book is copyright protected. This book is only for personal use. You
cannot amend, distribute, sell, use, quote or paraphrase any part, or the
content within this book, without the consent of the author or publisher.

Disclaimer Notice:
Please note that the information contained within this document is for
educational and entertainment purposes only. All effort has been executed
to present accurate, up to date, and reliable, complete information. No
warranties of any kind are declared or implied. Readers acknowledge that
the author is not engaging in the rendering of legal, financial, medical or
professional advice. The content within this book has been derived from
various sources. Please consult a licensed professional before attempting
any techniques outlined in this book.
By reading this document, the reader agrees that under no circumstances is
the author responsible for any losses, direct or indirect, which are incurred
as a result of the use of the information contained within this document,
including, but not limited to, — errors, omissions, or inaccuracies.
Table of Contents
PYTHON PROGRAMMING

INTRODUCTION

What Is Python?
Who Am I?
How Can This Book Help You?

CHAPTER 1: INTRODUCTION TO PYTHON

History of Python
Applications of Python
Different Versions of Python
Why You Should Learn Python
How to Install Python

CHAPTER 2: PYCHARM AND IDLE

Why is Python Interpreter Good?


How to Use the Python IDLE Shell?
How to Use IDLE to Open Python Files?
How to Change these Files?
IDE (Integrated Development Environment)
PyCharm
Python Style Guide

CHAPTER 3: PYTHON FOUNDATIONS

Why are Input Values Required?


Understanding the input() Function
Comments in Python
Reserved Keywords
Operators in Python
Augmented Assignment Operators
Exercises

CHAPTER 4: PYTHON VARIABLES

What are Variables in Python?


How to Name Variables
How to Define Variables
How to Determine the Memory Address of a Variable
Local and Global Variables

CHAPTER 5: DATA TYPES IN PYTHON

What exactly are Data Types?


Different Data Types
Strings
String Formatting
String Manipulation Techniques
Integers
Floating—Point numbers
Boolean Data Type

CHAPTER 6: ADVANCED DATA STRUCTURES IN PYTHON

Lists
Tuples
Dictionaries
Exercises

CHAPTER 7: CONDITIONALS AND LOOPS

Comparison Operators
Control Flow Statements
If/Else Conditional Statements
If Elif Else
For Loops
While Loop
Break and Continue
Exercises

CHAPTER 8: FUNCTIONS AND MODULES

Function Parameters
Arguments of a Function
Default Values
Scope
Modules
Modules and Built-In Functions
String Functions
Exercises

CHAPTER 9: OBJECT ORIENTED PROGRAMMING (OOP)

What Is OOP?
How Do I Create Classes?
How Do I Create Objects?
Inheritance
Exercises

CHAPTER 10: FILES IN PYTHON

File Paths
Creating New Folders
Functions to Manage Files

CHAPTER 11: EXCEPTION HANDLING

'Try’ and ‘Except'


Different Types of Errors

CHAPTER 12: ADVANCED PROGRAMMING

Pip Package Manager


Virtual Environment
The sys Module
Unit Testing
Scrapy
Requests
Pygame
Beautiful Soup
Pillow
Tensorflow
Scikit-Learn
Pandas
Matplotlib
Twisted
GitHub for Programmers

CONCLUSION

Programmer Features
What Next?

JAVA PROGRAMMING

INTRODUCTION

CHAPTER 1: SETTING UP YOUR JAVA ENVIRONMENT

The Basics of Java Installation


Understanding and Installing Package Managers: Maven, Gradle,
and Beyond
First Steps: Writing and Running Your First Java Program
Common Issues and Troubleshooting

CHAPTER 2: JAVA FUNDAMENTALS

Data Types, Variables, and Constants: The Building Blocks


Control Flow: Decisions and Loops
Java's Object-Oriented Paradigm: A Gentle Introduction
CHAPTER 3: DIVING INTO OBJECT-ORIENTED
PROGRAMMING

Classes and Objects: The Blueprint of Java


Constructors: Giving Life to Objects
Methods: Adding Behavior to Objects

CHAPTER 4: ADVANCING WITH OBJECT-ORIENTED


CONCEPTS

Understanding Inheritance: Leveraging Existing Code


Polymorphism: Flexibility in Action
Encapsulation: Shielding Your Data
Abstraction: Hiding Complexity

CHAPTER 5: GENERIC PROGRAMMING

The Need for Generics


Understanding and Creating Generic Classes
Bounded Type Parameters
Wildcards in Generics

CHAPTER 6: FUNCTIONAL PROGRAMMING IN JAVA

An Introduction to Lambda Expressions


Streams: Processing Collections More Elegantly
Common Stream Operations: Filtering, Mapping, and Collecting

CHAPTER 7: JAVA FEATURES OVERVIEW

Exception Handling: Dealing with the Unexpected


Java Collections: Lists, Sets, and Maps
Concurrency and Multi-threading: Harnessing the Power of Modern
Processors

CHAPTER 8: ADVANCED JAVA CONCEPTS


Modules: Organizing and Scaling Your Java Projects
Annotations: Adding Metadata to Your Code
Java I/O: Interacting with External Data

CHAPTER 9: REAL-WORLD JAVA DEVELOPMENT

Building a CRUD Application: From Start to Finish


Connecting Java with Databases
Best Practices: Writing Clean, Maintainable Code

CHAPTER 10: ADDRESSING FRUSTRATIONS AND


OVERCOMING CHALLENGES

Common Mistakes and How to Avoid Them


Overcoming Impostor Syndrome in the Tech World
Resources and Communities to Support Your Learning Journey

CHAPTER 11: FUTURE OF JAVA AND BEYOND

Keeping Up with Java’s Evolution


Exploring the Java Ecosystem: Frameworks and Tools
The Road Ahead: Furthering Your Java Career

GLOSSARY OF COMMON JAVA TERMS

CONCLUSION

SQL FOR BEGINNERS

INTRODUCTION

CHAPTER 1: RELATIONAL DATABASES AND SQL

Advantages of Relational Databases


What is SQL?
Advantages of SQL
CHAPTER 1: BASIC SQL SYNTAX AND COMMANDS

Create
INSERT INTO
SELECT
UPDATE
DELETE
DROP

CHAPTER 2: SQL DATA TYPES

Basic SQL Syntax


Data Types

CHAPTER 3: SQL DATA STRUCTURES

How to Use Data Structures


How to Select Data Structures
Stack Data Structure
Tree Data Structure
Linked List Data Structure

CHAPTER 4: WORKING WITH TABLES

Creating Tables
Altering Tables
Inserting Data
Updating Table
Deleting Data

CHAPTER 5: BASIC AND ADVANCED QUERY TECHNIQUES

JOIN
GROUP BY
HAVING
UNION
ORDER BY
ORDER BY DESC
INTERSECT
MINUS

CHAPTER 6: ADVANCED SQL TECHNIQUES AND


OPTIMIZATION

Joining Tables and Working with Multiple Data Sources


Subqueries and temporary tables
Grouping and Aggregating Data
Advanced Data Filtering and Sorting Techniques
Stored procedures and functions
Indexing and performance optimization

CHAPTER 7: INTEGRATIONS WITH OTHER DATA


MANAGEMENT TOOLS

What is Data Management?


Data Management Functions
Approach to Data Management
SQL Data Management Tools
Importing and exporting data to and from other formats

CHAPTER 8: WORKING WITH DATA IN A DISTRIBUTED


ENVIRONMENT

What is a Distributed Environment?


How is data processed in distributed database?
Layer for the Collection and Preparation of Data
Layer for Data Security
Layer for the Data Storage
Layer for Processing of Data
Data Visualization Layer
Advantages of the distributed database
CHAPTER 9: BUILDING DATA PIPELINES AND
AUTOMATING DATA PROCESSES

What are data pipelines and their uses?


Components of a data pipeline
Automating data processes in SQL
Using SQL in data analysis and business intelligence
Security and privacy considerations in SQL

JAVASCRIPT PROGRAMMING

INTRODUCTION

Why JavaScript
History of JavaScript
Features of JavaScript
Applications of JavaScript
Limitations of JavaScript
What makes JavaScript a lightweight programming language?
Is JavaScript interpreted, compiled, or both?

CHAPTER 1: JAVASCRIPT SYNTAX AND DATA TYPES

String
Number
BigInt
Boolean
Object
Symbol
undefined
null
typeof
JavaScript Data Types – Recap

CHAPTER 2: VARIABLES AND OPERATORS


What is an operator?
JavaScript Assignment Operators
JavaScript Arithmetic Operators
JavaScript Comparison Operators
JavaScript Logical Operators
JavaScript Bitwise Operator
JavaScript String Operators

CHAPTER 3: CONDITIONAL STATEMENTS

If-Else
If statement
JavaScript If else statement
JavaScript if else if statement

CHAPTER 4: LOOPS

For loop
While loop
Do-While loop
For-in loop

CHAPTER 5: FUNCTIONS

Introduction to JavaScript Functions


Declare a Function
Calling a Function
Parameters vs Arguments
Returning a Value
The arguments object
Function Hoisting

CHAPTER 6: OBJECTS

Overview of Objects in JavaScript


Creating Objects
Accessing and Modifying Object Properties
Working with Object Methods
Object Iteration and Manipulation
Working with Built-in Objects
Exercises

CHAPTER 7: CLOSURES

What is a Closure in JavaScript?


JavaScript Closure
JavaScript Closures and Loops
ES6 let Keyword
IIFE and Closures
Moving Forward With JavaScript Closures

CHAPTER 8: PROTOTYPES

Prototype Chain
Creating and Using Prototypes

CHAPTER 9: THE DOCUMENT OBJECT MODEL (DOM)

The Original Legacy DOM


The W3C
The IE4 DOM

CHAPTER 10: EVENT HANDLING

Click Event
MouseOver Event
Focus Event
Keydown Event
Load Event

CHAPTER 11: ASYNCHRONOUS PROGRAMMING

Asynchronous vs. Synchronous communication


What are JavaScript callbacks?
Promises in JavaScript
JavaScript's Async/Await

CHAPTER 12: JAVASCRIPT FRAMEWORK AND LIBRARIES

Comparing Libraries and Frameworks


JavaScript Libraries
JavaScript Frameworks
React
Angular
Node.js
NPM
Webpack
Babel

CONCLUSION
Python Programming
Introduction
Computers can be categorized as machines with no inherent intelligence,
but they have drastically helped to advance our world in countless ways.
With computers, our world runs much more efficiently and error-free—we
tell them what to do, and they deliver flawless results. Computer
programmers are the people who communicate with computers in what are
called programming languages, and they have been doing so for many
years. These programming languages vary based on their working systems,
just as human language varies based on region.
One of these computer programming languages is called Python, and in the
computer realm, this is a quite popular (and easy to learn) high-level
programming language. This book will intuitively teach you Python. Even
if you have no experience with any programming language, you will be able
to grasp the basics of Python and put them to use.
What Is Python?
Python is a high-level programming language that is popular within the
programming community. It is simple, versatile, and contains an extensive
library of third-party frameworks. It is also considered to be one of the most
popular modern programming languages, being highly accessible for
beginners. You can even use it to create software in your programming
domain of choice.
Accredited universities such as Stanford teach Python to computer science
graduates as an introductory language. Many online courses that explore
programming basics also use Python as the default language. As you can
see, it’s very prevalent and therefore highly useful to learn. For these
reasons, I am happy that you have chosen this book to help you learn
Python quickly and intuitively.
Who Am I?
If you search the Internet, you are likely to find thousands of resources
available for learning Python. And while this is great, it can also be
overwhelming—therefore, many beginners can get frustrated because they
do not have concise instructions with a clear walkthrough.
My name is Philip Robbins, and I am determined to offer a clear pathway
for beginners to excel. I have more than twenty years of experience working
in the field of software development using Python, and I am an expert
Python programmer. My love for programming started a decade ago when I
avidly played video games. It all started with my enthusiasm to mod a
Pokémon game that I was playing. My will to successfully change a small
bit of code to feel accomplished sparked excitement to understand
programming logic and variables at a young age. With some modding
experience, I was able to understand how programs work and spent time
experimenting with different programming languages.
Fast forward a few years, and I started creating small scripts that could
automate workflow. However, I had still not chosen a particular
programming language, and this made it challenging to be an actual
software program developer. All of the programming languages I had tried,
such as C and Pearl, were challenging to implement and almost made me
quit programming due to massive frustration many times. Fortunately,
during those turbulent times I discovered Python in its initial stages. Python
first began as a hobby project by one developer, so its initial form was not
very clean. Once it gained in popularity, however, fellow developers began
to notice the open-source project. This spurred them to add their
contributions as well. Thus, they effectively modeled it into the efficient
programming language it is today.
Within a few months of learning Python basics, I began implementing my
pre-existing code into Python. I was astounded by the code's portability as
well as its lack of clutter. Once I learned how Python worked, there was no
turning back. I began writing my software and publishing them using
different stores. Even though my main job was to create web applications, I
successfully created several other side projects in various domains with the
help of Python.
Now that I am proficient in Python, I am interested in helping people who
are struggling to learn this coding language. Even when I was first modding
games in the beginning stages, I always had a passion for quickly assisting
people in learning programming. I use layman’s terms to explain complex
topics, and this has helped many of my friends and colleagues understand
them better. My passion for programming and teaching has compelled me
to write this book to help beginners who are new to Python.
How Can This Book Help You?
Though Python programming looks easy to implement, in truth it is not. If
you have a thorough understanding of the several foundational topics
Python contains and how you can utilize them to solve problems, this is
incredibly helpful. As such, this book provides you with the theoretical
knowledge you need to know to understand the foundations and practicality
of the programming language you are trying to use.
To get the most out of this book, we recommend cognitive learning
techniques. These will enhance your experience with this material.

Use cognitive memory techniques such as Memory Palace to


keenly remember the data. However, there is a difference
between simply mugging up the required information in your
brain versus formally storing it when using cognitive
techniques.
Use mind maps to map different concepts to quickly implement
them in your projects. Mind maps are cognitive learning tools
that use visual excellence via a short diagram to remember large
amounts of data easily.
Use the passive recall technique to quickly review all of the
topics you have learned in this book. Passive recall can also
help strengthen your programming foundations.
Don’t just use the code given in this book. Instead, reimplement
your code using similar strategies. Using the simple copy-and-
paste technique will not help you in creating your code.
Use the Feynman technique to explain all of the basic
programming concepts you have learned in this book to
someone unaware of the subject. You have a strong knowledge
of the core foundations if you can explain concepts in simple
terms.
As a programming language, Python expects you to be as innovative as
possible. Therefore, if you treat programming with Python like solving a
puzzle, then you will intuitively discover ways to trick your brain into
creating complex code logic for addressing real-world problems. This book
helps you to become as effective as possible with Python programming.
Chapter 1: Introduction to Python

Python is a powerful programming language that is easy to learn, has a


strong foundation, and can support multiparadigm workflows. As a result,
it is an excellent starting point for beginners who want to delve into
programming. Python's popularity stems primarily from its lack of clutter
and boilerplate code.
For example, writing a simple snake game in C or C++ usually requires 300
lines of code. In contrast, with Python you can limit the number of lines of
code to less than 200. This significant difference in terms of implementation
contributed to Python becoming the most popular open-source language in
the world. Python quickly became the waypoint for the open-source
revolution, with so many enthusiastic programmers and developers writing
thousands of libraries for various computer fields.
History of Python
Guido van Rossum, who created Python, made it as a side project over the
Christmas break. Using what he learned working with the ABC
programming language, he made an interpreted programming language that
is easy to understand and use. He first used Python to impress hackers in an
online community with his knowledge of how Unix works.
But after getting feedback from his fellow programmers, he worked on it
for a few months to make it better. So, he made a programming language
that was easy and quick to understand. Guido van Rossum has been called
the "benevolent dictator" of the Python community because of what he has
done for the Python project. Open-source developers can be given this high
award.
Python has always been one of the 10 most popular programming
languages, according to TIOBE rankings, ever since it came out. Python's
simple way of solving problems has helped it beat other programming
languages, like Pearl, and become one of the easier ones for beginners to
learn.
Python is based on the idea that there is only one way to solve a problem,
which is different from the idea behind programming languages like Pearl,
which is that there are many ways to solve a problem. So, Python gave the
programming community the discipline it needed and made software
development grow by a factor of ten.
Look at the Python Applications below to see how important Python was to
programmers around the world.
Applications of Python
Python made its mark in many areas of science and technology today.
Web Domain
Python has had most of its early effect as a programming language on web
technology. While Java was the most popular thing on the web, Python
wasn't as popular. Over time, Python has become popular among web
developers thanks to third-party frameworks like Django and Tornado.
In the twenty years since then, Python has become one of the most popular
scripting languages for websites, second only to JavaScript. Python is a
programming language that is used by big companies like Google,
Facebook, and Netflix. A well-known web framework called Django can
also help programmers write backend code for several APIs.
Python is also popular for automating tasks, so it is often used to make bots
like Pinflux.
Scientific Computing
Python is popular with scientists because it is free for anyone to use. Also,
programs like Numpy and Scipy make it easier for computer scientists to do
experiments with less code. Since Python is also better at mathematical
calculations and software, Scientists have no choice but to use it these days.
Machine Learning and AI
AI and machine learning are now two technologies that can be used
together to give more jobs to developers. There are a lot of third-party
libraries for Python, like Tensorflow, that are all about implementing
Machine Learning algorithms.
Python is also very good at adapting to technologies like Deep Learning
and Natural Language Processing. This makes it one of the main candidates
to become a better language for making AI-related technology.
Linux and the Management of Databases
As businesses around the world grow, there is a big need for developers
who can manage databases and internal systems well. Developers need to
know enough about different operating systems, like Linux, and they also
need to know enough about Python to automate other procedures that are
needed to test how well methods work on an internal network.
Penetration Testing and Hacking
Python is also used by hackers with both good and bad intentions. For
example, white-hat hackers use Python tools that are widely used to do
penetration testing. On the other hand, hackers with bad intentions use
Python scripting to make exploits that automatically steal sensitive
information from their targets.
Python's ability to be used in almost any area of computer programming has
led to the development of several other high-level programming languages,
like Go, Groovy, and Swift. Python spread the idea that programming
should be as simple as possible.
Different Versions of Python
When Python came out at the start of the 1990s, it wasn't as good as it is
now. Rossum built the library without any help from anyone else, so it had
a lot of bugs and mistakes. But because Python was so popular right away
in the programming community, hundreds of independent developers
helped Rossum make a much bigger project in the two years after the first
version came out.
Python was also able to get a lot of smart people to check and change the
code because it was open source. Because of this, the Python core
programming team has put out two main versions, Python 2 and Python 3,
for developers all over the world in the last 20 years.
In 2022, Python 2 is still used by a lot of programmers, even though Python
core developers no longer support it. Choosing which version to use
depends on what you are doing.
Python 2
Python 2 is now an old version that came out in the year 2000. Still, it has
been the most used version of Python for more than 20 years. Python 2 is
easier to use and has a lot more frameworks and libraries from outside
sources that can be used for development.
Even though Python 2.7 will no longer get official updates after 2021, it is
still the best version for many software domains. But it's hard to move all of
the frameworks and libraries from Python 2 to Python 3, so many
companies still use Python 2 as their default version.
Python 3
Python 3.9 is the most recent version of the programming language that
developers can use. Python 3 is faster and gives developers many more
classes for working with the core library. Compared to Python 2, it is also
easy to keep up with.
Which one Should I Choose?
Which version of Python you use should depend on what kind of software
you are making. For example, a lot of data scientists use Python 3, while
developers who work with legacy software use Python 2 to connect
components.

Note:
All the Python code in this book is written in Python 3, since it makes more
sense for beginners to start with a newer version.
Why You Should Learn Python
Python started to become more popular in the early 1990s, when companies
all over the world started to use the internet's power to make complex web
applications. Traditional programming languages like C and C+ were hard
to learn and made it hard for programmers to write good code quickly.
During this time, Python helped many companies make libraries that
worked well with the C and C++ libraries they already had. Also,
programmers started using Python to quickly deploy code because it was
easier to work with than other high-level languages.
By learning about some of Python's many benefits, you can see how
powerful and easy it can be for developers with different backgrounds in
computer science.
It Is an Interpreted Language
Instead of using a compiler to run instructions like other programming
languages do, Python uses a new piece of software called an interpreter.
Instead of taking a lot of time to run a program with a compiler, the
interpreter uses modern computer techniques to parse the code before the
program is run. This dynamic parse time can cut down on the time you have
to wait while the program is running. Python also uses parts of natural
language to get rid of unproductive ways of coding that can slow down
production. Because of how it is set up, it is also easy to automate
programming in Python, which is why system developers and Linux
administrators like it so much.
It is Open Source
One of the first things that led to the open-source revolution was Python.
Because Python is open source, you can change any code and share it on
your own. Open-source culture also makes it easier for programmers all
over the world to share their knowledge and resources to make libraries and
frameworks that can help developers make new projects.
As a beginner, having one-click access to both complex and simple projects
can help you understand how programming works and make it easy to make
new, creative projects.
It Supports Multiple Paradigms
To write and run code, different programming languages use different
programming paradigms. Java, on the other hand, uses an object-oriented
paradigm, while C uses a functional paradigm. A programming paradigm
changes how developers work and how they try to solve a problem.
Python supports multiple paradigms, like the structured, functional, and
object-oriented paradigms. This makes it a good choice for programmers
who want to solve problems in different ways.
It uses a Garbage Collection Mechanism
Managing memory is an important skill for application developers to have.
High-level languages such as Java and C use complex data management
techniques. Even though these mechanisms work perfectly, it takes a lot of
time to keep them in good shape. In Python, on the other hand, memory is
handled by garbage collectors. You can easily use the data and variables
that this strategy no longer uses.
It Is Easy to Understand
One of the many reasons developers like Python is that it is easy to read.
All of the code is easy to understand, which makes it easy to keep up. When
Python code is easier to read, its quality goes up, and when the quality goes
up, it takes less time to fix bugs in the code.
Portability
Python can also run on any operating system, which makes it easy for
developers to use it in different ways with just a few hours of work. Users
only need to install the interpreter on their system for Python programs to
work.
For instance, let's say a programmer writes a program for Linux that makes
it easy to automate SQL database management. Then, anyone who has
access to the code can place it on Windows or Mac machines by changing a
few parts of it.
It Has Great Custom Libraries
If you want a programming language to be widely used, it needs to have
great libraries. Developers can play around with a lot of these libraries in
Python.
Aside from these custom libraries, programmers can also make interesting
software with the standard libraries that the Python core development team
gives them.
It Supports Component Integration
Python makes it easy for programmers to add new code to code that has
already been written. Also, its advanced integration of components makes it
a good choice for making advanced customization options for different
software applications.
Component integration keeps developers busy by adding new features to
older software so it can run on newer operating systems.
It Has a Great Community
The Python community is very helpful and can help new programmers
quickly solve any problems they run into while writing code. Aside from
Python forums, resources and well-written guides from a variety of
experienced programmers can help developers get past any problems.
Since there are a lot of open-source Python projects on GitHub, a hobbyist
programmer can just look at the code to see how complex logic is
implemented in software.
How to Install Python
To write Python code, you must install an interpreter on your system.
Without this interpreter, no developer would be able to write or run Python
programs. Python can be put on any modern operating system because it
can be moved around. In this section, we'll talk about how to install Python
on Linux, Mac, and Windows.
How do I Install Python in Linux?
Since most programmers use Linux as their main operating system, we'll
start by installing Python on your local machine using Linux. Linux is a
free operating system that most programmers and businesses use. Because
of this, Python is already on many Linux distributions.
To see if Python is installed on your Linux system, use the CTRL+ALT+N
command to open a new command terminal.
When the new command terminal opens, type the following command into
it.

Terminal Code:
$ python3
If Python is installed on your system, the license information for the version
of Python that is installed will show up in your terminal.
If you get the output "command not found," on the other hand, it means that
Python is not installed on your system. Since Python is not installed, you
can now use the package managers for Linux to install Python for different
distros.
Before installing any software on Linux, you must first update all the tools
on Linux and make sure there are no conflict errors that could stop Python
installation.

Terminal Code:
$ sudo apt-get upgrade
You can use the code above to update package files on a Linux system that
is based on Debian.
Use the following Pacman command to upgrade packages on an Arch-based
system.

Terminal Code:
$ sudo pacman -S
After upgrading the packages, you can use the commands below to install
Python on your Linux system.
Terminal code for Debian systems:
$ sudo apt-get install python3
Terminal code for Arch systems:
$ pacman -u python3
Look at the official Python documentation to install in other Linux
distributions like Gentoo and kali.
How do I Install Python on macOS?
macOS is the operating system that Apple makes by default. Python 2 is
often installed as native software because it is built with UNIX support.
Make sure you open a new terminal from Settings > Utilities > Terminal to
see if macOS is installed on your Apple-supported hardware.
Enter the following command once a new terminal has been opened.

Terminal Code:
$ python3
If you don't see a Python version message, it means that Python is not
installed on your system. To install Python from scratch, use homebrew.

Terminal Code:
$ brew install python3

How do I Install Python on Windows?


Windows is the most used operating system in the world, based on the
number of people who use it. Many people and programmers use Windows
because it is easy to use, and there are many ways for Python programmers
to quickly get their code into Windows.
To install Python on your Windows system, you must first download an
executable package from the official Python website. Once the package is
downloaded, you can install the software by double-clicking on it. For
Python code development to work on some Windows systems, you may
need to change the environment variables in the Control panel.
Once everything is set up as needed, open a command prompt window to
see if the Python interpreter is correctly installed.

Command Prompt Code:


>> python —version
If the command tells you what version of Python is installed, then Python is
set up correctly on your system. If not, you might have to copy and paste
the error into Google or use Python forums to figure out what's wrong.
Chapter 2: PyCharm and IDLE

Once you've installed Python, you'll need a development environment on


your system to write programs. IDLE stands for "Integrated Development
and Learning Environment." Even though you can work with the basic
IDLE that comes with a basic Python installation, developers are
encouraged to use IDEs (Integrated Development Environments) like
PyCharm for better software development workflow. IDEs make developers
more productive and make it easier for them to find bugs in code that has
already been turned into software.
Why is Python Interpreter Good?
The Python interpreter is great because it is flexible and has more features
than traditional compilers. For example, compared to compilers, a Python
interpreter makes you wait less. Compilers run the code after it has been
written and check for mistakes. The interpreter, on the other hand, checks
the code as it is being written and lets the programmer know if there is a
problem before the code is run. Real-time error reporting is a good way for
beginners to learn how to code while they are doing it.
When you install Python on your computer, it also installs the IDLE. To
start the IDLE, you can type "Python" in the terminal interface. The REPL
mechanism (Read-Eval-Print Loop) is used by IDLE to show the output on
the computer screen. REPL is a basic method that Python interpreters use to
check the lines that have been written and parse them so that they can be
shown on the screen. This is done based on the input and output that are
given.
Python IDLE can be a great tool for people who are just starting to learn
how to code. Even though most enterprise software development is done on
IDEs like PyCharm, learning some basic commands for Python IDLE can
help you understand how Python interpretation works.
How to Use the Python IDLE Shell?
Once Python is installed, open a terminal or command prompt and type the
following command to start the IDLE.
Command:
$ python
As shown below, when you press Enter or Return, a new shell will open.
>>>
You can test how Python IDLE works on your system by using some of the
basic math or Print commands.

Program Code:
>>> print ("This is a sample to check that the IDLE works")

Output:
This is a sample to check that the IDLE works
When the Enter button is pressed, the program goes into REPL mode, and
the text between the double quotes is shown on the computer screen. This is
because IDLE knew that the shell window used the print() method to show
strings.
You can also use math operations to test the IDLE workflow.

Program Code:
>>> 8 + 3

Output:
11

Exercise:
Use the IDLE window to check the results of other math operations, like
multiplication and division.

Note:
It's important to remember that as soon as you close the terminal window,
all of your code will be lost. So, even if we use an IDLE, we need to make
sure that all of our code is put into a Python file.
How to Use IDLE to Open Python Files?
IDLE makes it simple to open and read Python files with a .py extension on
the terminal. Keep in mind that this command will only function if you are
in the same directory as the Python file.

Program Code:
$ python mysample.py
The prior command will open the previously written code for the
programmers to read.

IDLE can automatically highlight unique syntax components.


IDLE assists developers in completing code by providing hints.
IDLE can easily indent code.
To use any Python files on your IDLE shell, use the GUI file option and
click the 'Open' button. However, advanced programmers advise using the
path to open Python files if you are not in the same directory.
How to Change these Files?
Once the files are open in IDLE, you can begin editing the code in the file
with your keyboard. Because IDLE provides line numbers, developers can
easily manipulate any non-indented code. Once the file has been edited,
press the F5 key to run it on your terminal code.
If there are no errors, the output will be displayed; otherwise, the traceback
errors will be displayed.
While not as efficient as other advanced IDEs on the market, Python IDLE
serves as an excellent debugging tool. It has several debugging features,
including the ability to place endpoints, catch exceptions, and parse code to
quickly debug the code. However, it is not ideal and may cause issues if
your Project library grows.
Regardless of how little it offers, IDLE is possibly the best developer tool
for complete beginners.

Exercise:
Develop a new program in Python IDLE to add two numbers and debug it
with breakpoints. If you are unfamiliar with any programming components,
you are free to use any Internet resources to solve this simple problem.
IDE (Integrated Development Environment)
Python IDLE is frequently not recommended for real-world application
development due to its inability to handle highly demanding projects.
Developers are instead asked to manage and develop their code in
specialized development environments known as IDEs. Furthermore, IDEs
provide programmers with tight integration capabilities with various
libraries.
IDE characteristics
1. Simple Integration Into Libraries &
Frameworks
One of the important features of IDEs is that they make it simple to
integrate libraries and frameworks into software applications. IDLE
requires you to assign them individually each time you use them, whereas
IDEs do the hard work for you by autocompleting various import
statements. Many IDEs also support direct git repository integration.

2. Integration of Object Oriented Design


Many Python programmers who create applications employ an object-
oriented paradigm. Unfortunately, Python IDLE does not include any tools
to help developers create applications while adhering to object-oriented
principles. All modern IDEs include components such as class hierarchy
diagrams to help developers get their projects started with better
programming logic.

3. Syntax Highlighting
Syntax highlighting assists programmers in increasing productivity and
avoiding simple, obvious errors. For example, you cannot use reserved
keywords like 'if' to name variables. The IDE automatically detects this
error and assists developers in understanding it through syntax highlighting.

4. Code Completion
All modern IDEs use advanced artificial intelligence and machine learning
techniques to complete code for developers automatically. The IDEs gather
a lot of information from the packages you use, so they can suggest
different variables or methods based on your input and the logic you're
writing. Even though auto-completion is a useful feature, you should never
rely entirely on it because it can occasionally disrupt program execution and
cause errors.

5. Version Control
Version control is a major source of frustration for developers. For example,
if you use private libraries and frameworks in your application, they may
occasionally be updated, causing your application to fail. As a developer,
you must be aware of these changes and implement new code execution for
all applications to function properly. The version control mechanism
enables developers to easily update their core applications without causing
any disruptions to previously written code. IDEs support direct version
control with websites like GitHub.
IDEs can also provide advanced debugging features for developers in
addition to these features. For example, the most popular Python IDEs for
independent developers and organizations are PyCharm and Eclipse. We
will use PyCharm as our default IDE in this book because it is much more
efficient than Eclipse and much easier to set up.
PyCharm
PyCharm is a Python-only IDE produced by JetBrains, a pioneer in
software tool development. Initially, the JetBrains team created PyCharm to
manage their IDEs for other programming languages. However, due to its
portability, the JetBrains team later released it as a standalone product for
users worldwide. PyCharm is available for all major operating systems and
comes in two flavors: community and professional.
The community version is open-source, free software that anyone can use to
write Python code. It does, however, have some limitations, particularly in
terms of version control and third-party library integration.
The professional version is a paid IDE that offers advanced functionality
and numerous integration options to developers. For example, using the
professional version of PyCharm IDE, developers can easily create web or
data science applications.
What Features does PyCharm Provide?
PyCharm is well-known for its unique features for enthusiastic Python
developers, as well as its high-quality integration capabilities.

1. Code Editor
PyCharm's code editor is among the best in the industry. When working
with new projects in this editor, you will be astounded by the code
completion abilities. Furthermore, JetBrains has used several advanced
machine learning models to make the IDE intelligent enough to understand
even the most complex programming blocks and provide useful
suggestions.
While working as a developer, the PyCharm editor can also be customized
for a better viewing experience. Light and dark themes are available to
users, allowing you to change the theme based on your mood.

2. Code Navigation
PyCharm's complex and comprehensive file organization system makes it
simple for programmers to manage files. Bookmarks and lens mode, for
example, can assist Python programmers in effectively managing their
essential programming blocks and code logic.

3. Refactoring
PyCharm includes advanced refactoring features that allow developers to
easily change the names of files, classes, and methods without breaking the
program. When you use IDLE to refactor your code, it immediately breaks
the code because the default Python IDLE is not intelligent enough to
distinguish between new and old names.
When it comes to updating their code or migrating to a much better third-
party library for one of their software components, most Python developers
use Advanced refactoring capabilities.

4. Web Technology Integration


The majority of Python developers work in the web domain, which
accounts for a sizable portion of the software industry. PyCharm simplifies
the integration of developers' software with Python web frameworks such
as Django. PyCharm is also intelligent enough to understand HTML, CSS,
and JavaScript code, which are commonly used by web developers to create
web services.
All of these features make it simple for Python web developers to integrate
existing web code into a Python framework.

5. Integration With Scientific Libraries


PyCharm is also well-known for its strong support for scientific and
advanced mathematical libraries like SciPy and NumPy. While it will never
completely replace your data integration and cleaning setup, it will assist
you in developing a basic pseudo logic for all of your data science projects.

6. Software Testing
PyCharm can execute high-level unit testing strategies for even the most
complex and large projects with numerous members. It also includes
advanced debugging tools and remote configuration capabilities for using
the Alpha and beta testing workflows.
How to Use PyCharm?
With enough information about PyCharm, you should be convinced that it
is a necessary development tool for your local system. This section contains
the information you need to install PyCharm and understand how to use it
to better manage your Python projects.

Step—1: Install PyCharm


PyCharm can be installed on almost any operating system.
To begin, obtain the installation package from the official website or one of
the numerous package managers.
Navigate to the JetBrains official website and click the downloads tab in the
upper right corner. Now, depending on your operating system, download the
executable or dmg file and double-click it to follow the instructions on the
screen.
To download a professional version of the software, you must first provide
payment information to download a trial version. When the trial period
expires, you will be charged and will be able to use the professional version
without issue.
Note:
For the PyCharm IDE to install successfully on your system, Python must
be installed. This is because it detects the Python path and installs the
software's core libraries automatically.

Step—2: Create New Projects


After installing the software, launch the PyCharm IDE from your
applications or the Desktop icon. When you open PyCharm, a new popup
will appear, allowing you to start a new project from scratch. You can open
a new project using the button in the upper left corner of the software
interface using the “File” option. Other options include importing and
exporting existing projects or quickly saving current working projects.
When you first open a Python project, you will be prompted to choose
which Python interpreter you want to use for all programming procedures.
If you don't know where to look for the Python interpreter, choose
'virtualenv,' which will automatically search the system and find one for
you.

Step—3: Using PyCharm to Organize


Creating new folders and resources for your Program files is essential once
you begin creating projects with PyCharm.
To create a new folder on your project interface, simply select the new -->
folder option. You can include any Python scripts or assets used in your
software in this section.
When you create a new file in a separate folder, a file with the.py extension
is created. As a result, if you want to create different class files or
templates, you must do so explicitly while creating a file in your folder.

Step—4: Advanced Features in PyCharm


Once the code is written and integrated, you can use the built-in IDLE
interface or the PyCharm unique output interface to run it quickly.
All code you write will be automatically saved in real time, so you won't
have to worry about losing any critical project data due to a bad network
connection or power outage. To save a copy of a project on your local
system, simply press Ctrl S or Cmd S.
When the program is finished, press Shift + F10 to run and compile the
code with the help of an interpreter.
Using the Ctrl F or Cmd F commands, you can search for any method,
variable, or snippet in your project. Simply use this shortcut and enter the
information you're looking for.
Once the Python code has been imported and deployed to the required
operating systems, you must begin setting up a debugging project
environment to constantly clear bugs on your system. To place breakpoints
and solve logical problems without messing up the entire code logic or
breaking the core program, press Shift + F9.
Python Style Guide
Python programming grew in popularity among programmers due to the
programming philosophy it supported and continues to support. Python
aimed to be simple, whereas other high-level programming languages
aimed to be more complex. Pearl is a great example of how this philosophy
was applied and how it complicated many things for an average
programmer.
Python core developers encouraged early Python adopters to adhere to a
simple set of well-known principles known as "The Zen of Python" to write
code that both works and looks good. Even after twenty years, these
principles are still relevant for Python programmers, and every Python
programmer should be aware of them.
Enter the Python code below on the terminal to read all of these principles.

Terminal Code:
$ import this
We will go over some fundamental principles to better understand the
philosophy that Python promotes to developers.
Beautiful Is Better Than Ugly.
All Python programmers are encouraged to write semantically symmetrical
code that is also visually appealing. Beautiful code must be well-structured;
thus, programmers must write conditionals without complicating the code.
Many lines of code can be made more visually appealing by employing
indentation techniques. Beautifying code improves readability and can help
to reduce runtime.
Explicit Is Better Than Implicit.
For whatever reason, many developers try to conceal their programming
logic, making it difficult for other programmers to understand. Python
opposes this routine and encourages developers to write explicit code logic
that is understandable by all. This is also one of the reasons why open-
source Python frameworks and libraries are more popular.
Simple Is Better Than Complex.
Your primary goal as a Python programmer should be to write simple code.
Simplifying your code logic can help you improve your programming
language skills. Your ability to write less complex code improves as you
gain experience.
Complex Is Better Than Complicated.
As with any software, there are times when you need to write complex code
that solves multiple problems at once. When working on complex code,
avoid making it too complicated. Using exceptions and files effectively can
assist you in quickly reducing complicated code that may later turn into
annoying bugs.
There Should Be Only One Approach.
Unlike its predecessor languages, C and C++, Python advocates for
consistency. As a Python programmer, you only need to use one logic for all
of the instances in your program. Uniformity provides flexibility and makes
it easier to maintain the code.
Chapter 3: Python Foundations

Python programmers must ensure that input is provided directly from the
user and output is provided based on the inputs to have dynamic
applications. The Python interpreter and all functions in your program can
access the user's input values.
We will provide a few example programs in this chapter to help you
understand how to improve the user experience of the software you have
created based on input and output operations.
Why are Input Values Required?
Application survival is dependent on input values. Everything runs on the
user's input values, from web applications to the most recent metaverse
applications. When you log in to Facebook, for example, you must enter
your email address and password. These are inputs, and your account will
be authenticated only if the information provided is correct.
Face data points are used as input in advanced applications such as facial
recognition technology. Nowadays, every real-world application requests
and collects user input data to provide a better user experience.

Use Case:
Assume you created a Python application for a mature audience that cannot
be used by anyone under the age of 18.
For the above scenario, we can use conditional input verification by asking
the user to enter their age. If the user is over the age of 18, the application
will become available to him or her. However, if the user is under the age of
18, the application will be inaccessible. Python evaluates whether or not
someone can access your software based on inputs from all supported data
types. This is just one example from the real world. Numerous applications
can be performed by utilizing input from your end users.
Understanding the input() Function
When you call the input() function in the middle of a Python program, the
interpreter will pause and wait for the user to enter the values using one of
their input devices, such as a keyboard, mouse, or mobile touchscreen.
Typically, the user will provide input in response to the prompt. To create
real-world applications, you must first create a good prompt GUI. This
chapter will look at the text command prompts available to developers.
After entering the values, the user must press the "Enter" button on their
system for the interpreter to resume and parse the logical programming
statements used.

Example:
sample = input ("Which country are you from? ”)
print (sample + " is a beautiful country!")
When the above program is run and executed, the user will first see an
output prompt, as shown below.

Output:
Which country are you from?
At this point, the user has to enter an answer. Let’s suppose we write
“United States of America”:
Which country are you from? United States of America
United States of America is a beautiful country!
You can experiment by changing the input above to another country to see
what happens.

Output:
Which country are you from? France
France is a beautiful country!

How to Write User Prompts?


It is recommended to use better prompts to get the user's attention when
using the input() function and attempting to receive inputs from the user.
Remember not to include any extraneous information in the text. Make the
prompt as straightforward as possible.
Prompt Code:
example = input("Which is your favorite hockey team? ”)
print ("So you are a " + example + " fan. Hurray!")

Output:
Which is your favorite football team? Boston Bruins
So you are a Boston Bruins fan. Hurray!
You can also use the input() function to prompt the user by displaying
multiple lines of strings.
We use the print() function to display text on the screen from the beginning
of the book. The only recommended method for printing to a computer
screen is print().
Any input you pass to the print() function will be converted to a string
literal and displayed on the screen. While you are not required to be aware
of the print() function's arguments, learning some parameters that can help
you format your code is recommended.

What are String Literals?


String literals are advanced characters that can assist you in quickly
formatting your data. For example, \n is a common string literal that can
assist you in entering data from a new line.

Program Code:
prompt = "This is a simple question to find out what you like."
prompt += "\n So, please say your favorite food: "
example = input(prompt)
print (example + " is delicious")

Output:
This is a simple question to find out what you like.
So, please say your favorite food: Pasta
Pasta is delicious
Other popular string literals that can help you output data with a new tab or
without whitespaces and separators are \t, \b, and \d.

What is an End Statement?


The print() function also accepts an end argument, which can be used to
append any string data to the end of your string literals, as shown below.

Program Code:
print("Italy is a beautiful country. ", end = "Do you agree? ")
print("Yes, I do!")

Output:
Italy is a beautiful country. Do you agree? Yes, I do!
In the above example, “Do you agree?” is the appended text
Numerical Values as Input
So far we have seen how the input() function is used to capture user input as
a string. When expecting numerical input, such as integers (int) or floating-
point numbers (float), the string obtained from input() must be converted to
the respective numerical type. This is achieved using int() for integers and
float() for floating-point numbers.
We'll delve deeper into the specifics of int and float data types in the "Data
Types" section.

Practical Example for ‘int’:


Let's say we want to write a program that asks the user for their and then
prints a message indicating what the age was the previous year. Since age is
typically counted in whole years, we use int for this purpose.
# Ask the user for their age
age_str = input("Enter your age: ")

# Convert the string input to an integer


age = int(age_str)

# Compute age last year


age_last = age - 1

# Print the age


print("Last year you were", age_last, "years old.")

Output:
Enter your age: 50
Last year you were 49 years old.
Typing “int(age_str)” we are converting the string to an integer. Notice that
we could also have directly written the following:
age = int(input("Enter your age: "))
To compute the quantity “age – 1” the “age” variable must be an integer.
Without the conversion, the code would not work:
age_str = input("Enter your age: ")
age_last = age - 1
print("Last year you were", age_last, "years old.")

Output:
Enter your age: 50
ERROR!
Traceback (most recent call last):
NameError: name 'age' is not defined

Practical Example for ‘float’:


Suppose we want to calculate the area of a circle. The user will input the
radius, which might be a decimal number, so we use float.
# Ask the user for the radius of a circle
radius = float(input("Enter the radius of the circle: "))

# Calculate the area (using 3.14 as an approximation of Pi)


area = 3.14 * radius * radius

# Print the area


print("The area of the circle is:", area)

Output:
Enter the radius of the circle: 21
The area of the circle is: 1384.74
Here, we directly convert the radius from a string to a float for calculation.
The float() function allows us to handle decimal numbers, making it
suitable for scenarios where precision is needed.
Comments in Python
When programming teams work on complex and time-consuming projects,
a lot of information must be exchanged between team members for the
project's essence to be understood. Comments allow programmers to pass
information without disrupting the program's flow.
When a programmer uses comments, the Python interpreter ignores the
comments and moves on to the next line. However, because Python has a
large number of open-source projects, comments assist developers in
understanding how to integrate third-party libraries and frameworks into
their code.
Comments make the code more readable and easier to understand. While it
may appear that some programmers do not need to remember the code logic
they have written, you would be surprised at how often programmers forget
the code logic they have written. Having specific insights into how you
wrote the code logic will be very useful for future reference.
Python allows programmers to use two types of comments in their code.
Comments on a Single Line
Single-line comments are the most commonly used type of comment by
Python programmers because they can be easily written between the lines
of code. To use single-line comments, use the '#' symbol. Anything that
comes after this symbol will be ignored by the interpreter.

Program Code:
# This is an example of a single-line comment followed by a print of a hash symbol
print ("This is an example.")

Output:
This is an example.
Because a single-line comment was used, the interpreter ignored it and only
executed the print statement.

Why are Single-Line Comments Important?


Single-line comments are commonly used in the middle of code to assist
other programmers in understanding how the program logic works and to
detail the functions of the implemented variables.
Comments in Multiple Lines
While it is possible to write three or four lines of continuous comments
using single-line comments, it is not recommended because Python
provides a better way to annotate multi-line comments. Python
programmers can use string literals to create multi-line comments, as shown
below.

Program Code:
'''
This is a comment
In Python
with 4 lines
Author: Python Best '''
print ("This is an example.")

Output:
This is an example.
When you run the above program, only the print statement is executed, just
like single-line comments.

Why Are Multiline Comments Important?


Multiline comments are frequently used by programmers to define license
details or to explain comprehensive information about various packages and
methods with various implementation examples. The code can be
effectively understood by the programmers who are reading it.
Reserved Keywords
Reserved keywords are programming language default keywords that
programmers cannot use as identifiers while writing code. Identifiers are
commonly used to name variables, classes, and functions.
The interpreter will throw an error if you use a reserved keyword in your
program. For example, using 'for' for one of your variables will not work
because 'for' is typically used in Python programming to define a specific
type of loop structure.
There are 33 reserved keywords that you are not permitted to use in your
programs. As a Python programmer, it is critical to avoid making
unnecessary mistakes when working on complex projects.
Exercise:
Using the Python terminal, try to find the reserved keywords in Python to
become familiar with the Python commands we discussed previously.
Operators in Python
In mathematics, operators are first used to form mathematical expressions.
The first programmers used these operators and the basic programming
components to easily assign and manipulate values.
Operators are commonly used by computer programmers to combine literal
and form statements or expressions.

Example:
2x + 3z = 34
Here, 2x, 3z, and 34 are literals, and + and = are operators that are applied
to these literals to form an expression.
Operators can be combined with any number of literal values to form
complex expressions that can aid programmers in the implementation of
difficult algorithms.

Example:
a = 18
b = 20
print(a + b)

Output:
38
a and b are the operands, whereas = and + are operators that are used.
Different Types of Operators
Different types of operators can be used by programmers to implement
various types of programming logic. The most commonly used operators
are arithmetic operators, which assist programmers in applying
mathematical logic to various literals, such as variables, in their code.
The arithmetic operators that a Python programmer needs to know to write
better programming structures are addition, subtraction, multiplication, and
division.

1. Addition
To add two literals to a program, use the addition operator. These literals
can be variables or lists, and they can sometimes be data of two different
data types. The Python interpreter is smart enough to recognize two
different data types and return a result to the programmer. The addition
operation is represented by the symbol '+'.

Program Code:
x = 26
y = 15
z=x+y
# + is the addition operator
print(z)
When the program runs using an IDE or IDLE, the interpreter will add the
two variable values and assign them to the variable ‘z’, as specified by the
developer.

Output:
41

2. Subtraction Operator
The subtraction operator is used to subtract two literals. These literals can
be variables or lists, and they can sometimes be data of two different data
types. - is the symbol for the subtraction operation.

Program Code:
x = 26
y = 15
z=x-y
# - is the subtraction operator
print(z)
When the program is executed using an IDE or IDLE, the interpreter will
find the difference between the two variable values and input it into ‘z’ as
specified by the developer.

Output:
11

3. Multiplication Operator
The multiplication operator computes the product of two literals. These
literals can be variables or lists, and they can sometimes be data of two
different data types. The symbol * represents a multiplication operation.

Program Code:
x=6
y=4
z=x*y
# * is the multiplication operator
print(z)
When the program runs in an IDE or IDLE, the interpreter will find the
product of the two variable values and enter it into the ‘z’ variable as
specified by the developer.

Output:
24

4. Division Operator
In a program, the division operator is used to find the division quotient of
two literals. The quotient can also be calculated using floating-point
numbers, and the division symbol "/" is used.

Program Code:
x=8
y=4
z=x/y
# / is the division operator
print(z)
When the program runs in an IDE or IDLE, the interpreter will find the
quotient of the two variable values and enter it into the ‘z’ variable as
specified by the developer.

Output:
2.0
Random documents with unrelated
content Scribd suggests to you:
As Cornplanter was the half-brother of the prophet, he was supposed to be
in some way connected with these revelations, more especially, as the
prophet strongly inculcated the principles of temperance, to which the Chief
had been, for many years, a devoted advocate. Red Jacket, and others, used
these transactions to the disadvantage of Cornplanter, and from thenceforth
he ceased to take any part in the affairs of the Six Nations, and but little in
that of the Seneca tribe generally, but devoted himself chiefly to his own clan
of that tribe. This clan, or part of his tribe, had for many years been under his
official and personal direction. Reference, before this period, is often made to
the ABeel Senecas, and in a map published in 1792, by Reading Howell, a
considerable portion of the country on the upper waters of the Conewango,
and near Chatauque lake, is designated thus: "O'Beals—Cayentona."[V]
[V] This map is in the possession of the Pennsylvania Historical Society;
it was recently presented by Samuel Agnew, Esq.

In 1797, Cornplanter again visited Philadelphia, the seat of government of


the United States. His principal object appears to have been to pay his
respects to President Washington, and take an official leave of him on his
retirement from the public service. His address to Washington, on this
occasion, is marked with his usual good sense and eloquence. This address
was fortunately preserved among the papers of Thomas Morris, son of Robert
Morris.[W]
[W] See infra, page 90.

General Washington's answer was not preserved. As he entertained the


highest respect and esteem for Cornplanter, no doubt his words to the Chief
were expressive of his kind regards for his Indian friend, and his best wishes
for the happiness and prosperity of the Seneca tribe.
From henceforth the career of Cornplanter was unconnected with the
general history of his country. He fixed his permanent residence upon the
tract of land on the Allegheny river, granted to him by the Commonwealth of
Pennsylvania. The grant from the Commonwealth is dated March 16, 1796. In
the patent the tract is designated "Planter's Field," and his town is called
"Jennesadaga." It became his home in life, and is now his resting place in
death. Here he directed his efforts to the civilization and moral improvement
of his people, and as an efficient means to produce the result inculcated the
principles of temperance—to which he had himself been long devoted.
In 1802 he visited President Jefferson, at the city of Washington, for
counsel and encouragement. In Mr. Jefferson's excellent and characteristic
letter to him, he expresses his approbation of Cornplanter's conduct, and adds:
"Go on then, brother, in the great reformation you have undertaken. Persuade
our Red Men to be sober, and to cultivate their lands; and their women to spin
and weave for their families. * * * It will be a great glory to you to have been
the instrument of so happy a change, and your children's children, from
generation to generation, will repeat your name with love and gratitude
forever. In all your enterprises for the good of your people, you may count
with confidence on the aid and protection of the United States, and on the
sincerity and zeal with which I am animated in the furthering of this humane
work. You are our brethren of the same land; we wish you prosperity, as
brethren should do." Thus encouraged, our Chief devoted his time and
energies to the best interests of his people, and under his influence and
example they made considerable advances in civilization and moral
improvement.
When the war of 1812, with England, broke forth, Cornplanter, although
then far advanced in years, yet he offered his services to the United States, to
go on the war path, and accompanied by two hundred warriors of his nation,
repaired to Franklin, Venango county, when he learned that Colonel Samuel
Dale was about to march from that place to the frontiers with the Venango
regiment. Arriving at Franklin, he called upon Colonel Dale, and desired a
statement of the causes and objects of the war, which being satisfactorily
explained to him, he made an address, in which he said: "That many years
ago a boy came over the great waters and settled among his people of the Six
Nations; sometime thereafter the father followed to keep him in subjection;
the Indians helped the father, but the boy was too much for both, and drove
the father home. And now, when the father had become an old man, and the
boy a strong man, and a good neighbor to his nation, he wished to show his
friendship for the Thirteen Fires by taking his two hundred warriors to assist
to drive the old man across the great waters."—Colonel Dale was obliged to
inform the Chief that he had no authority to receive his warriors into his
regiment, or take them to the frontiers. Cornplanter insisted that his warriors
ought not to stay at home and live idly in their wigwams whilst their white
friends and brothers were upon the war path. So persistent was he in sending
his warriors, that he could only be satisfied by the promise of Colonel Dale to
send for them when their services were required, and when he should receive
authority from the government to muster the Indians into the service of the
United States, and that in the mean time he was to go home to his seat at
Jennesadaga and have his warriors ready to respond at a moment's call. They
were not called for by Colonel Dale, but Cornplanter, sent a considerable
number of his warriors to the American army; they acted as scouts, and were
highly serviceable on the frontiers, and in the Niagara campaign. His son,
Henry ABeel, led these warriors; he held the the commission of major, and did
good service to the United States in that war.
The condition of Cornplanter's town in 1816, is thus described by Rev.
Timothy Alden, of Allegheny college, Meadville, Pa., who visited it in that year:
"Jennesadaga, Cornplanter's village, is on a handsome piece of bottom land,
and comprises about a dozen buildings. It was grateful to notice the
agricultural habits of the place, and the numerous enclosures of buckwheat,
corn and oats. We also saw a number of oxen, cows and horses, and many
logs designed for the saw-mill and the Pittsburg market. Last year, (1815,) the
Western Missionary society established a school in the village, under Mr.
Samuel Oldham. Cornplanter, as soon as apprised of our arrival, came over to
see us and took charge of our horses. Though having many around him to
obey his commands, yet in the ancient patriarchal style, he choose to serve us
himself, and actually went into the field, cut the oats and fed our beasts. He
appears to be about sixty-eight years of age,[X] and five feet ten inches in
height. His countenance is strongly marked with intelligence and reelection.
Contrary to the aboriginal custom, his chin is covered with a beard three or
four inches in length. His house is of princely dimensions compared with most
Indian huts, and has a piazza in front. He is owner of thirteen hundred acres
of excellent land, six hundred of which encircle the ground-plot of his little
town. He receives an annual stipend from the United States, of two hundred
and fifty dollars. Cornplanter's brother, lately deceased, (called the Prophet,)
was known by the high-sounding name, Goskukewanna Kannedia, or Large
Beautiful Lake."
[X] Mr. Alden was deceived by appearances. Cornplanter time, about
eighty-four years of age.

Thus, in the altitude and with the authority of an ancient patriarch, he


continued to preside over his people, and promote their prosperity and
improvement, without interruption or molestation, until the year 1822, when
the authorities of Warren county, within the bounds of which he resided,
attempted to levy taxes upon him and his clan. The old Chief had never
before been called on for that purpose, and he objected to their payment. An
armed sheriff's posse was called out to enforce the payment, but arriving near
Cornplanter's town, it was deemed prudent to send forward a few of their
number to confer with the Chief. When they came to his house, they noticed a
considerable number of Indians lounging about, and some of them were
partly concealed in the bushes near by. Cornplanter received the committee
with great dignity. The interview took place near his house, and around the
sides of it were arranged about one hundred rifles. When asked for the
payment of the taxes, the old warrior sternly refused, and pointing to the
guns, said, "an Indian for each rifle;" and in response to his call, his clansmen
sprang forward to the house. Whereupon the sheriff and his men withdrew,
without enforcing the claim. Cornplanter afterwards, for the sake of peace,
went to Warren, and gave his note for the amount of the taxes. This note was
never collected. The Legislature of Pennsylvania released the taxes, and
exonerated him and his heirs forever, from the payment of taxes on the lands
granted to him by the Commonwealth.[Y] The Governor sent commissioners to
explain the transaction. Cornplanter met the commissioners at the court house
in Warren, when he made a characteristic and appropriate address.[Z]
[Y] Journal House of Representatives, 1822-3.
[Z] This address is fully presented in Day's Historical Collections, p. 655.

This tax collector's raid would afford a fine subject for a painter: the
romantic scenery of the Allegheny river, the old warrior's wigwam, the rifles
arranged around it, the Indians in the bush, the last war-whoop of the old
Chief as he called his men to the rescue—worthy of perpetuation as the
expiring flash of the warlike fire of the last War Chief of his tribe.
Thomas Struthers, Esq., of Warren, was well acquainted with Cornplanter; at
my request, he has furnished the following statement of an interview he had
with the Chief in 1831: "In 1831, I accompanied some gentlemen, residents
of Pittsburg and Butler, who desired to pay their respects to him. It was a
pleasant day in May, when we called on him. He talked no English. I
introduced the gentlemen through an interpreter, whom I had engaged, and
informed him that they had called to pay their respects to him. He seemed
much pleased that his white friends were inclined to pay him such attention.
The introduction took place in front of his log cabin, on the bank of the
Allegheny river. He gave orders to some young Indians, the import of which
we soon ascertained, by the fact that they immediately collected some
boards, and placed them for seats around a log sled, in the form of a hollow
square. This done, the old Chief pointed out to each of the party his seat, and
all sat facing inward. He then took his seat in the centre, and announced that
he was prepared to hear any communications we had to make. I told him we
had not come to buy lands or timber, nor to trade for furs and skins, but had
called on him in the spirit of friendship, to pay our respects to the great
Indian Chief, whom we had learned to admire as a warrior, and especially as
the friend of the United States, who had inculcated the principles of peace
and Christianity among his people. I referred briefly to the schools established
among his people by the Friends of Philadelphia.
"The old Chief replied in a speech, which would compare well with many of
our best State papers. His manner was dignified and eloquent, and his eye lit
up, as if by inspiration; so that it was very interesting to listen to what he
said, although we could not understand it, until the interpreter rendered it to
us. He spoke of the relations between the white men and the red men—the
war and bloodshed caused by the former, to displace the latter from their
hunting grounds—the peace effected with the Six Nations—dwelt particularly
on the virtues of General Washington, the great and good White Father. He
brought forth from a well covered valise, in which they were carefully
wrapped in linen cloth, two or three "talks," as he termed them, on
parchment, to which was appended the autograph of Washington. He said he
had met Washington a number of times, and treated with him. His single eye
sparkled with animation, when his name was mentioned. And in conclusion,
he thanked the Great Spirit that there were now no wars or blood-shedding
going on, but that peace and good will existed amongst all men and all
nations, so far as he could hear. He spoke as a statesman and philanthropist,
whose mind was occupied with the weighty interests of mankind, rather than
with merely the affairs and concerns of a family or tribe. He thanked us for
our call upon him, and invited us to dine with him, which we accepted. The
bill of fare was jerked venison and corn mush; the latter was prepared in the
Indian manner; each guest having a tin pan about half-full of hot water, in
which the Indian meal was mixed at the pleasure of the guest."
The personal appearance of Cornplanter, towards the close of his long and
eventful life, is well described by Judge Thompson, now of the Supreme Court
of Pennsylvania, in an article written in 1836, and re-produced in Day's
Historical Collections of Pennsylvania, p. 657. I had a professional interview
with the aged Chief, in the summer of 1835, to which I have already briefly
referred. His personal appearance was therefore known to me. I agree with
Judge Thompson, in his description of him, and as the article contains other
interesting remarks, I insert it here, as follows:
"I once saw the aged and venerable Chief, and had an interesting
interview with him about a year and a half before his death. I thought of
many things, when seated near him beneath the wide spreading shade of an
old sycamore, on the banks of the Allegheny; many things to ask him; the
scenes of the revolution; the generals that fought its battles and conquered
the Indians; his tribe; the Six Nations, and himself. He was constitutionally
sedate; was never observed to smile, much less to indulge in the luxury of a
laugh. When I saw him he estimated his age to be over one hundred years. I
think one hundred and three was about his reckoning of it. This would make
him near one hundred and five years old at the time of his decease. His
person was much stooped, and his stature was far short of what it once had
been—not being over five feet six inches at the time I speak of Mr. John
Struthers, of Ohio, told me, some years since, that he had seen him near fifty
years ago, and at that period he was about his height, viz: six feet, one inch.
Time and hardship had made dreadful impressions upon that ancient form.
The chest was sunken and his shoulders were drawn forward, making the
upper part of his body resemble a trough. His limbs had lost their symmetry,
and become crooked. His feet, too, (for he had taken off his moccasins,) were
deformed and haggard by injury. I would say that most of his fingers on one
hand were useless; the sinews had been severed by a blow of the tomahawk
or scalping-knife. How I longed to ask him what scene of blood and strife had
thus stamped the enduring evidence of its existence upon his person. But to
have done so, would, in all probability, have put an end to all further
conversation on any subject. The information desired, would certainly not
have been received, and I had to forego my curiosity. He had but one eye,
and even the socket of the lost organ was hid by the overhanging brow
resting upon the high cheek bone. His remaining eye was of the brightest and
blackest hue. Never have I seen one, in young or old, that equalled it in
brilliancy. Perhaps it had borrowed lustre from the eternal darkness that
rested on its neighboring orbit. His ears had been dressed in the Indian mode,
all but the outside had been cut away; on the one ear the ring had been torn
asunder near the top, and hung down his neck like a useless rag. He had a
full head of hair, white as the driven snow, which covered a head of ample
dimensions and admirable shape. His face was not swarthy, but this may be
accounted for from the fact, that he was but half Indian. He told me that he
had been at Franklin, more than eighty years before the period of our
conversation, on his passage down the Ohio and Mississippi, with the warriors
of his tribe, on some expedition against the Creeks or Osages. He had long
been a man of peace, and I believe his great characteristics were humanity
and truth.
"It is said that Brant and The Cornplanter were never friends after the
massacre of Cherry valley. Some have alleged, because the Wyoming
massacre was, in part, perpetrated by the Senecas, that The Cornplanter, was
there. Of the justice of this suspicion, there are many reasons for doubt. It is
certain that he was not the Chief of the Senecas at that time.
"As he stood before me—the ancient Chief in ruins—how forcibly was I
struck with the truth of the beautiful figure of the old aboriginal Chieftain,
who, in describing himself, said 'he was like an aged hemlock, dead at the
top, and whose branches alone were green.' After more than one hundred
years of most varied life—of strife—of danger—of peace—he at last slumbers
in deep repose on the banks of his own beloved Allegheny."
Pennsylvania has acted with liberality and kindness to this venerated Chief.
She granted to him three valuable tracts of land; on one of which he had fixed
his residence. It is the place where he now rests in the quietude of the grave.
The first report on the subject of these grants to Cornplanter, is dated
March 24, 1789. It is contained in a communication from General Mifflin, then
President of the Supreme Executive Council of Pennsylvania, to Richard Peters,
Speaker of the General Assembly, in which he encloses General Richard
Butler's letter, recommending the grant of fifteen hundred acres of land to The
Cornplanter, a Seneca Chief.[AA] General Butler's letter is dated March 23,
1789. In it he says: "I beg leave to mention, that Captain ABeel, alias The
Cornplanter, one of the principal Chiefs of the Seneca tribe of the Six Nations,
has been very useful in all the treaties since 1784, inclusive, and particularly
to the State of Pennsylvania; this he has demonstrated very fully, and his
attachment, at present, to the State, appears very great. This has induced me
to suggest to your Excellency and Council, whether it may not be good policy
to fix this attachment by making it his interest to continue it. This, from the
ideas he possesses of civilization, induces me to think if the State would be
pleased to grant him a small tract of land within the late purchase, it would be
very grateful to him, and have that effect. This may be done in a manner that
would render him service without lessening his influence with his own people.
The quantity need not be large; perhaps one thousand or fifteen hundred
acres. My wishes for the quiet and interest of the State, as well as the merits
of the man, induced me to mention this matter."[AB]
[AA] Colonial Records of Pennsylvania, volume I, p. 37.
[AB] Pennsylvania Archives, 1786-90, p. 562.

The Great Founder of Pennsylvania established his government on "deeds


of peace." He has the unquestioned pre-eminence of having treated the
aboriginal inhabitants with greater justice and rectitude than any other
Proprietor or Founder of an American State.—"The settlement of this Province
(Pennsylvania) was founded on the principles of truth, equity and mercy, and
the blessings of divine Providence attended the early care of the first founders
to impress these principles on the minds of the native inhabitants; so that
when their numbers were great, and their strength vastly superior, they
received our ancestors with gladness, relieved their wants with open hearts,
granted them peaceable possession of the land, and for a long course of time
gave constant and frequent proofs of a cordial friendship."[AC] It is, therefore,
an appropriate testimonial to the character of Penn, as well as to that of
Cornplanter, that the Commonwealth of Pennsylvania should, by her
constituted authorities, cause the erection of this monument to the memory of
this worthy and distinguished Indian Chief. And it is the only monument, so
far as my knowledge extends, erected by public authority in the United States,
either national, or sub-national, to the memory of an Indian Chief.
[AC] Address to Governor Morris by the "people called Quakers," April
12, 1756. Manuscript Historical Society of Pennsylvania.

The character of the venerable Cornplanter has been exhibited, though I


fear imperfectly, in this sketch of his life and services. We have seen that he
was a brave warrior and chieftain, an able statesman and an eloquent orator.
In the latter part of his life, especially, his prominent characteristics were a
love of peace and temperance. And it is believed by those who knew him
best, that the Truths of Christianity had made a deep impression on his mind.
A circumstance which occurred about the year 1822, has been cited by
several writers as an evidence of his return to the superstitions of his race. I
refer to his destroying a sword and pistols, and some other military
accoutrements which had been presented to him by Washington, and a gold
laced hat which was given him by Governor Mifflin; also a French flag and
superb belt of wampum, trophies of valor, which had been for several
generations in his family, in honor of some of his mother's ancestors, who
won them in battle from the French. It is alleged that he did this act in a
moment of alarm, as if the Great Spirit had moved him to destroy the
memorials of his friendly relations with the whites. On the contrary, it clearly
appears that under the influence of Christianity, particularly as evinced in the
teachings of the Society of Friends, who had established schools in his nation,
he became so firm an advocate of peace, that he wished to remove from him
all the memorials that re-called to his recollection the scenes of war and blood
through which he had passed. He carefully preserved the memorials of peace
of which he was in possession. I myself noticed, for he exhibited them to me,
how great a regard he had for the parchment documents which he possessed,
that were subscribed by Washington; and with what scrupulous care and
painstaking he had preserved them. These papers, and others of a like
character, are now in the possession of the family of Cornplanter, and are most
interesting historical memorials. Their preservation, in such manner as may be
agreeable to the descendants of the Chief, is a matter of interest and
solicitude to all persons who properly appreciate such materials of history.
Those who knew Cornplanter personally, had the greatest respect for him.
Dr. Irvine, of Brokenstraw, a son of General C. Irvine, an intimate friend of the
Chief, in a letter to me, says: "I frequently heard my father say, that
Cornplanter was one of the most honest and truthful men he ever knew,
whether white or red." Judge Johnson, of Warren, under whose direction this
(Cornplanter) monument is erected, states to me, "so far as he was personally
known to residents in this section of country, he was regarded as a living
example of integrity, truthfulness, purity, temperance, fatherly affection for his
tribe and race, and a generous Indian hospitality to all. He possessed the
universal affection and veneration of his tribe and of all men who knew him."
Such was the life and career of Cornplanter; and such his character as
shown from history, from the testimony of contemporaries, and of living
witnesses. He died in this Indian village, (Jennesadaga,) on the 18th of
February, 1836, aged about one hundred and five years.
This is no ordinary occasion. A great Commonwealth, by a solemn act of
legislation, and by her agents here this day, honors the memory of the
distinguished Indian Chief, whose mortal remains lie mouldering in this grave.
We this day dedicate this monument to the memory of Cornplanter, an Indian
Chief of the Seneca tribe and of the Six Nations—and may we, both white
men and red men, and our children's children, as long as this beautiful river
bears its waters to the ocean, venerate his memory and emulate his virtues.
ADDENDUM.
I have recently examined Mr. Ketchum's history of Buffalo and the Senecas.
The facts he presents corroborate the views I have presented of the character
and services of Cornplanter. I am surprised, however, to notice that he
expresses an opinion adverse to our Chief. He does him great injustice when
he says; "There is no doubt that Cornplanter was at heart in the British
interest, up to the period of Wayne's victory in 1794." He also makes the
extraordinary assertion, that Cornplanter acted in concert with Brant, during
the period of the Indian troubles in Ohio, after the Revolutionary war!
The contrary most clearly appears by the whole course of conduct of our
Chief; as well as by his speeches, his letters and his participation in treaties.
With Brant, Cornplanter never was on friendly terms, and after the war of the
Revolution, their policy, and even personal relations, were adverse and hostile.
Mr. Ketchum, himself, shows that there existed between these Chiefs "a
personal dislike."
While Cornplanter was aiding Washington and his agents, Colonels Proctor
and Pickering, and others, to preserve peace with the hostile Indians of the
west, and conciliate the Six Nations, Brant was the agent of the British to
keep up the war, and he even sent some of his warriors to join the enemy,
when they took up the hatchet; he made his home with the British, and was
in constant communication with Colonels Gordon and M'Kee, the commanders
at Niagara and Detroit, and with other British officers.
The writer referred to adds the following: "As a warrior, whatever may be
thought or said by whites, Cornplanter, in the estimation of the Indians who
were their contemporaries, was the superior of Brant. The Senecas were a
nation of warriors; and it will be admitted that they did the most of the
fighting for the Six Nations, during nearly two centuries of their history, with
which we are conversant. From the time Cornplanter came on the stage, (and
he entered upon the war path early,) down to the close of the Revolutionary
war, he had no superior, and few equals as a warrior. His other qualifications
will be judged by the record he has left in his speeches and letters, and in the
archives of our State and National Government."—Vol. 1, p. 411.
I am content to let the personal and political character of our Chief be
judged by the records thus referred to. And I think I have shown in this
Memorial, from these records, that Cornplanter was not only a distinguished
warrior, statesman and orator, but that he was, after the close of the
Revolutionary war, the active, faithful and devoted friend of the government
and people of the United States. And that he also well deserves the inscription
on the monument erected by Pennsylvania to his memory, "Distinguished for
talent, courage, eloquence, sobriety and love for his tribe and race, to whose
welfare he devoted his time, his energies and his means, during a long and
eventful life."
There is one trait in the character of Cornplanter, not heretofore noticed,
which is referred to by Colonel Proctor in his narrative, and which I think
ought to be presented here. Colonel Proctor was sent by Washington, to visit
Cornplanter, to engage him and other Chiefs, to go on an embassy of peace to
the Western Indians. He traveled by way of Wyoming and the Susquehanna. I
quote from his narrative, under the date of March 20, 1791.
"This day we set forward for Captain Waterman Baldwin's, above
Wilkesbarre; arrived there in the evening, halted for him part of two days, as I
had orders to take him with me to the residence of The Cornplanter, at which
place he was intended to act as instructor to the Indian youth, as also a
director in the mode and management of agriculture, for the use and benefit
of the Indians. This gentleman was made prisoner by Cornplanter during the
late war, (Revolution,) and was treated by him with remarkable tenderness,
until legally exchanged."
ADDRESSES
OF
JOHN LUKE AND STEPHEN S. SMITH.
The following addresses were then made by the Indians herein mentioned;
they were translated by Harrison Halftown and Benjamin Williams, both
Senecas. Mr. Snowden took notes of these addresses, and has written them out
as follows:
John Luke, a councillor of the Seneca nation, said: Brothers! White men and
Indians:—It has been laid upon me to say a few words. We were well pleased
when we heard that the State of Pennsylvania had directed that a monument
should be put up to the memory of Cornplanter, at his grave. And we were
pleased when word came to us that the white people and Indians should be
here to-day to see the monument set in its proper place, and to hear what
our white brothers should say on the occasion. We are thankful for what has
been done by Pennsylvania, and for the good words we have heard this
beautiful day. The occasion will long be remembered by us. This monument,
more enduring than the wampum which our forefathers used to record events
and keep them in remembrance, will remind us of the kindness of
Pennsylvania to our great and good Chief, and keep bright the chain whose
links have united us to the Quaker State even from the time of Onas (William
Penn) to the present day. Brothers! The Cornplanter was known to us to be an
honest man, and without deceit, and we are glad to hear, by the words
spoken this day, that our white brethren so regard him, and respect his
memory. He made the treaties and speeches referred to this day, and I now
say that it is proper that all the people should remember that every word that
has been said, so far as I understand them, are words of truth. We always
understood that Cornplanter desired his children, and his nation, to follow the
example of the white people in cultivating the land. It lies upon our hearts
that we should remember the words of The Cornplanter.
Friendship was established between the red men and the white men by
treaties, and we wish them to stand permanent. This is all I have to say in
behalf of my people. Farewell!
Stephen S. Smith, a Seneca Indian, and a Chief of the Six Nations, then rose
and said: Friends and Brothers! We are grateful for what is done and said
here this beautiful day. The sun shines upon us, and we are here as brothers
to do honor to the memory of old Cornplanter. It is in accordance with the
laws and customs of the Six Nations that the people should meet to
commemorate the memory of the dead.
Brothers! We are now a feeble people in numbers and in power; our
forefathers were strong and powerful. This is known to us, and it is grateful to
our hearts to hear the history of the Six Nations described to us to-day. It is
gratifying to us to hear the words we have heard this day, so true and plain,
delivered by our brother, from Philadelphia, who so well depicted the life and
character of Cornplanter. And here at his grave, where his bones are buried, it
is our duty to remember his instructions to his people, to work, and also, to
plant our land; and now it is our duty to prosecute that work as his children.
Brothers! We have been told that the Indians are like the leaves which fall at
this season of the year. The leaves do fall, but we live in hope that the next
summer will bring them forth again. My wish is, that what remains of the Six
Nations, and their children's children, should continue to live on the lands
which they now own by means of reservations secured to them by the States
of New York and Pennsylvania. I am not willing to see the day when these
hills will no longer look down upon the cabins of our people. I hope they will
live here, and on the New York reservations, neighbors of our friends, the
white people, until we and they are called away unto the place of everlasting
rest; where there is but one people, one mind and one tongue. I hope our
children, to the remotest generations, will come here and look at this
monument to old Cornplanter, and read what is inscribed upon it; and my
desire is that the Indians of the Seneca nation should continue to live here,
not only as long as this handsome monument stands, but as long as these
hills and valleys remain, and the waters of the Allegheny mingle with the Ohio
and Mississippi. And now, on behalf of my nation, I return thanks to the State
of Pennsylvania, and to our white brethren present, for what has been so well
done this day; and say to all farewell.
NOTE BY J. R. SNOWDEN.
The following is a brief statement of the present location and population of
the Six Nations of Indians:

SENECAS.

1. Senecas on the Allegheny river, in Pennsylvania, fifteen miles above Warren,


at Cornplanter's town, (Jennesadaga.)

Population 80
Acres of land owned 300

2. Senecas on the Allegheny reservation, in New York, a few miles above the
Pennsylvania line.

Population about 900


Acres of land 26,600

3. Senecas on Cattaraugus reservation, in Erie and Cattaraugus counties, New


York.

Population about 1,700


Acres of land under cultivation 5,000

4. Senecas at Tonnawandas, in New York.

Population about 700


Acres of land 7,000

ONEIDAS.
1. Oneidas, in Oneida and Madison counties N. York.

Population about 250


Acres of land 400
2. The largest remnant of this tribe, (Oneidas,) reside in Brown county,
Wisconsin.

Population about 800


They possess a large body of land.

ONONDAGOS.

The residence of this tribe is about six miles south of the city of Syracuse, in
the State of New York.

Population about 350


Acres of land owned 7,600

TUSCARORAS.
Their residence is about seven miles north-east of Niagara Falls.

Population about 350


Acres of laud held by them 6,250

RECAPITULATION OF POPULATION.
Senecas 3,380
Oneidas 1,050
Onondagos 350
Tuscaroras 350
Total 5,130

The present condition of these remnants of the Six Nations is quite


respectable. In most of the reservations they have schools and places of
public worship. Many of them belong to the Methodist and Baptist churches.
The Chief of the Six Nations, Stephen S. Smith, who made a speech at the
inauguration of the Cornplanter monument, is a minister in the Baptist church.
He is a man of intelligence and respectability, I here insert a letter I have
recently received from him, which will doubtless be interesting to our readers.
"Akron, N Y., July 10, 1867.
"Dear Sir:—I am very desirous of obtaining a copy of the history of the life
of Cornplanter. If you have a copy of the history that you spoke at the raising
of the monument on the Cornplanter reservation last October, and will send it
to me for the use and benefit of our young men, you will confer a favor upon
me and them that I shall be most grateful to re-pay, when an opportunity is
presented. And if you have a copy of the minutes of the addresses delivered
that day, and taken by yourself, I should be most happy to receive a copy of
the same also.
"If your noble State saw fit to appropriate money to fence the grave of the
deceased Cornplanter, I shall be most happy to meet you there and assist you
in surrounding the last resting place of our departed brother, with the
respectful barricade furnished by a grateful people.
"I am sorry, that it is necessary, in speaking of our honored brother, John
Luke, who was with us at the monument meeting last October, that he will be
with us no more at our meetings this side of the setting sun. He took his
departure for the great spiritual hunting ground last April.
"Yours truly,
"STEPHEN S. SMITH,
"Chief of Six Nations.
"To James Ross Snowden, Philadelphia."
An appropriation having been made for that object, by the Legislature at
its last session, a substantial and appropriate fence was placed around the
grave and monument of Cornplanter on the 20th of September, 1867. It
consists of marble posts with carved caps; iron rails with chains and tassels,
and presents a very handsome appearance.
In honor of the completion of the monument, and to express their thanks
to the Great Spirit, and their gratitude to the Commonwealth of Pennsylvania
and her agents, the Senecas had a "green corn feast," on the 23d, 24th and
25th of September. It was a great occasion, and was largely attended. Their
ceremonies had relation not only to the completion of the monument, but to
express their thanks to the Great Spirit for the abundant crops which have this
year rewarded their agricultural labors. The erection of the Cornplanter
monument, and the proceedings relating to it, have had an excellent and
benign influence upon these Indians. A friend writes to me: "The natives are
greatly pleased with all that has been done; they have better crops than
usual, and act more civilized. These proceedings have increased their self-
respect, and made an enduring mark upon their grateful hearts."
APPENDIX.
JOINT RESOLUTION AUTHORIZING THE
CORNPLANTER MONUMENT.
The Joint Resolution of the Legislature of Pennsylvania, authorizing the
erection of the monument to Cornplanter, is in the following words:
WHEREAS, Solomon O'Bail, a grandson of Cornplanter, an Indian, who
rendered eminent services to the State and Nation, during the Revolutionary
war and the early history of Pennsylvania, and Mark Pierce, his interpreter,
have just had a hearing before the Senate:
And whereas, A recognition of the eminent services of Cornplanter, is due
from the government of Pennsylvania; therefore.
Be it Resolved by the Senate and House of Representatives of the
Commonwealth of Pennsylvania in General Assembly met, That the State
Treasurer shall pay to Solomon O'Bail, the sum of five hundred dollars out of
any moneys in the treasury not otherwise appropriated, and the further sum
of five hundred dollars to Samuel P. Johnson, to be expended in erecting and
enclosing a suitable monument in memory of Cornplanter.
(Signed)
JAMES E. KELLEY,
Speaker of the House of Representatives.
DAVID FLEMING,
Speaker of the Senate.
Approved—The twenty-fifth day of January, Anno Domini
one thousand eight hundred and sixty-six.
A. G. CURTIN.
SPEECH OF CORNPLANTER,
TO PRESIDENT WASHINGTON, AT PHILADELPHIA, IN THE YEAR 1790.

Father! The voice of the Seneca nation speaks to you, the great councillor,
in whose heart the wise men of all the Thirteen Fires have placed their
wisdom. It may be very small in your ears, and we therefore entreat you to
hearken with attention, for we are about to speak of things which are to us
very great. When your army entered the country of the Six Nations, we called
you the Town Destroyer; and to this day, when that name is heard, our
women look behind them and turn pale, and our children cling to the necks of
their mothers. Our councillors and warriors are men, and cannot be afraid;
but their hearts are grieved with the fears of our women and children, and
desire it may be buried so deep as to be heard no more. When you gave us
peace, we called you father, because you promised to secure us in the
possession of our lands. Do this, and so long as the lands shall remain, that
beloved name shall live in the heart of every Seneca.
Father! We mean to open our hearts before you, and we earnestly desire
that you will let us clearly understand what you resolve to do. When our
Chiefs returned from the treaty at Fort Stanwix, and laid before our council
what had been done there, our nation was surprised to hear how great a
country you had compelled them to give up to you without your paying, to us,
anything for it. Every one said that your hearts were yet swelled with
resentment against us for what had happened during the war, but that one
day you would re-consider it with more kindness. We asked each other, "What
have we done to deserve such severe chastisement?"
Father! When you kindled your Thirteen Fires separately, the wise men
assembled at them told us that you were all brothers, the children of one
great father, who regarded, also, the red people as his children. They called
us brothers, and invited us to his protection; they told us that he resided
beyond the great water where the sun first rises; that he was a King, whose
power no people could resist, and that his goodness was as bright as that
sun. What they said went to our hearts, we accepted the invitation, and
promised to obey him. What the Seneca nation promise they faithfully
perform, and when you refused obedience to that King, he commanded us to
assist his beloved men in making you sober. In obeying him, we did no more
than yourselves had led us to promise. The men that claimed this promise
told us you were children and had no guns; that when they had shaken you,
you would submit. We hearkened to them, and were deceived, until your
army approached our towns. We were deceived; but your people, in teaching
us to confide in that King, helped to deceive us, and we now appeal to your
heart—is the blame all ours?
Father! When we saw that we were deceived, and heard the invitation
which you gave us to draw near to the fire which you had kindled, and talk
with you concerning peace, we made haste towards it. You then told us that
we were in your hand, and that by closing it you could crush us to nothing,
and you demanded from us a great country as the price of that peace which
you had offered us—as if our want of strength had destroyed our rights. Our
Chiefs had felt your power, and were unable to contend against you, and they,
therefore, gave up that country. What they agreed to has bound our nation,
but your anger against us must by this time be cooled, and although our
strength has not increased, nor your power become less, we ask you to
consider calmly, were the terms dictated to us by your commissioners
reasonable and just?
Father! Your commissioners, when they drew the line which separated the
land then given up to you, from that which you agreed should remain to be
ours, did most solemnly promise that we should be secured in the peaceable
possession of the lands which we inhabited east and north of that line. Does
this promise bind you?
Hear now, we beseech you, what has happened concerning that land. On
the day in which we finished the treaty at Fort Stanwix, commissioners from
Pennsylvania told our Chiefs that they had come there to purchase all the
lands belonging to us within the lines of their State, and they told us that their
line would strike the river Susquehanna, below Tioga Branch. They then left
us to consider of the bargain till next day. On the next day, we let them know
that we were unwilling to sell all the lands within their State, and proposed to
let them have part of it, which we pointed out to them in their map. They told
us that they must have the whole; that it was already ceded to them by the
great King, at the time of making peace with you, and was their own; but
they said that they would not take advantage of that, and were willing to pay
us for it—after the manner of their ancestors. Our Chiefs were unable to
contend at that time, and, therefore, they sold the lands up to the line which
was then shown to them as the line of that State. What the commissioners
had said about the land having been ceded to them at the peace, our Chiefs
considered as intended only to lessen the price, and they passed it by with
very little notice; but since that we have heard so much from others, about
the right to our lands, which the King gave when you made peace with him,
that it is our earnest desire that you will tell us what it means.
Father! Our nation empowered John Livingston to let out part of our lands
on rent, to be paid to us. He told us that he was sent by Congress to do this
for us, and we fear he has deceived us in the writing he has obtained from us.
For since the time of our giving that power, a man of the name of Phelps has
come among us, and claimed our whole country, northward of the line of
Pennsylvania, under purchase from that Livingston, to whom he said he had
paid twenty thousand dollars for it. He said, also, that he had bought,
likewise, from the Council of the Thirteen Fires, and paid them twenty
thousand dollars more for the same. And he said, also, that it did not belong
to us, for the great King had ceded the whole of it when you made peace with
him. Thus he claimed the whole country north of Pennsylvania, and west of
the lands belonging to the Cayugas. He demanded it; he insisted on his
demand, and declared that he would have it all. It was impossible for us to
grant him this, and we immediately refused it. After some days, he proposed
to run a line at a small distance east-ward of our western boundary, which we
refused to agree to. He then threatened us with immediate war if we did not
comply.
Upon this threat, our Chiefs held a council, and they agreed that no event
of war could be worse than to be driven, with our wives and children, from
the only country which we had any right to, and, therefore, weak as our
nation was, they determined to take the chance of war, rather than submit to
such unjust demands, which seemed to have no bounds. Street, the great
trader to Niagara, was then with us, having come at the request of Phelps, and
as he always professed to be our great friend, we consulted him upon this
subject. He also told us that our lands had been ceded by the King, and that
we must give them up.
Astonished at what we heard from every quarter, with hearts aching with
compassion for our women and children, we were thus compelled to give up
all our country north of the line of Pennsylvania, and east of the Genesee
river, up to the fork, and east of a south line drawn from that fork to the
Pennsylvania line.
For this land, Phelps agreed to pay us ten thousand dollars in hand, and
one thousand forever. He paid us two thousand dollars, and five hundred
dollars in hand, part of the ten thousand, and he sent for us to come last
spring and receive our money, but instead of paying us the remainder of the
ten thousand, and the one thousand dollars due for the first year, he offered
us no more than five hundred dollars, and insisted that he agreed with us for
that sum, to be paid yearly. We debated with him for six days, during which
time he persisted in refusing to pay us our just demand, and he insisted that
we should receive the five hundred dollars; and Street, from Niagara, also
insisted on our receiving the money as it was offered to us. The last reason he
assigned for continuing to refuse paying was, that the King had ceded all the
lands to the Thirteen Fires, and that he had bought them from you, and paid
you for them.
We could bear this confusion no longer; and determined to press through
every difficulty, and lift up our voice that you might hear us, and to claim that
security in the possession of our lands, which your commissioners promised
us. And we now entreat you to inquire into our complaints, and redress our
wrongs.
Father! Our writings were lodged in the hands of Street, of Niagara, as we
supposed him to be our friend; but when we saw Phelps consulting with
Street, on every occasion, we doubted of his honesty towards us, and we
have since heard that he was to receive, for his endeavors to deceive us, a
piece of land ten miles in width, west of the Genesee river, and near forty
miles in length, extending to Lake Ontario; and the lines of this tract have
been run accordingly, although no part of it is within the bounds which limits
his purchase. No doubt he meant to deceive us.
Father! You have said that we are in your hand, and that by closing it you
could crush us to nothing. Are you determined to crush us? If you are, tell us
so; that those of our nation who have become your children, and have
determined to die so, may know what to do.
In this case, one Chief has said he would ask you to put him out of pain.
Another, who will not think of dying by the hand of his father or his brother,
has said he will retire to the Chatauque, eat of the fatal root, and sleep with
his fathers in peace.
Before you determine on a measure so unjust, look up to God, who has
made us as well as you. We hope he will not permit you to destroy the whole
of our nations.
Father! Hear our case; many nations inhabited this country, but they had
no wisdom, and therefore they warred together. The Six Nations were
powerful, and compelled them to peace; the lands, for a great extent, were
given up to them, but the nations which were not destroyed, all continued on
those lands, and claimed the protection of the Six Nations, as the brothers of
their fathers. They were men, and when at peace, had a right to live on the
earth. The French came among us and built Niagara; they became our
fathers, and took care of us. Sir William Johnson came and took that Fort from
the French; he became our father, and promised to take care of us, and did
so, until you were too strong for his King. To him we gave four miles around
Niagara, as a place of trade. We have already said how we came to join
against you; we saw that we were wrong; we wished for peace; you
demanded a great country to be given up to you; it was surrendered to you,
as the price of peace, and we ought to have peace, and possession of the
little land which you then left us.
Father! When that great country was given up, there were but few Chiefs
present, and they were compelled to give it up, and it is not the Six Nations,
only, that reproach these Chiefs with having given up that county, the
Chippewas, and all the nations who lived on those lands westward, call to us,
and ask us "Brothers of our fathers, where is the place you have reserved for
us to lie down upon?"
Father! You have compelled us to do that which has made us ashamed.
We have nothing to answer to the children of the brothers of our fathers.
When, last spring, they called upon us to go to war to secure them a bed to
lie upon, the Senecas entreated them to be quiet, till we had spoken to you.
But on our way down, we heard that your army had gone toward the country
which those nations inhabit, and if they meet together, the best blood on both
sides will stain the ground.
Father! We will not conceal from you that the Great God and not man has
preserved The Cornplanter from the hands of his own nation. For they ask
continually "where is the land which our children, and their children after
them, are to lie down upon." You to us say, that the line drawn from
Pennsylvania to Lake Ontario would mark it forever on the east, and the line
running from Buffalo creek to Pennsylvania would mark It on the west, and
we see that it is not so. For first one, and then another, comes and takes it
away by order of that people which you tell us promises to secure it to us. He
is silent, for he has nothing to answer. When the sun goes down, he opens his
heart before God, and earlier than that sun appears upon the hills he gives
thanks for his protection during the night; for he feels that among men,
become desperate by their danger, it is God only that can preserve him. He
loves peace, and all that he had in store he has given to those who have been
robbed by your people lest they should plunder the innocent to re-pay
themselves. The whole season which others have employed in providing for
their families, he has spent in his endeavors to preserve peace; at this
moment his wife and children are lying on the ground, and in want of food;
his heart is in pain for them, but he perceives that the Great God will try his
firmness in doing what is right.
Father! The game which the Great Spirit sent into our country for us to eat
is going from among us. We thought that he intended we should till the
ground with the plough, as the white people do, and we talked to one another
about it. But before we speak to you concerning this, we must know from
you, whether you mean to leave us and our children any land to till. Speak
plainly to us concerning this great business.
All the lands we have been speaking of belonged to the Six Nations, and
no part of it ever belonged to the King of England, and he could not give it to
you.
The land we live on, our fathers received from God, and they transmitted it
to us for our children, and we cannot part with it.
Father! We told you that we would open our hearts to you. Hear us once
more.
At Fort Stanwix, we agreed to deliver up those of our people who should
do you any wrong, that you might try them, and punish them according to
your law. We delivered up two men accordingly, but instead of trying them
according to your laws, the lowest of your people took them from your
magistrate and put them immediately to death. It is just to punish murder
with death; but the Senecas will not deliver up their people to men who
disregard the treaties of their own nation.
Father! Innocent men of our nation are killed one after another, and our
best families; but none of your people who have committed the murders have
been punished.
We recollect that you did not promise to punish those who killed our
people, and we now ask, was it intended that your people should kill the
Senecas, and not only remain unpunished by you, but be protected by you
against the revenge of the next of kin?
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like