
Getting Acquainted with Python
Python is an open source, high-level programming language
developed by Guido van Rossum in the late 1980s and presently administered by
Python Software Foundation. It came from the ABC language that he helped create
early on in his career. Python is a powerful language that you can use to
create games, write GUIs, and develop web applications.
It is a high-level language. Reading and writing codes in
Python is much like reading and writing regular English statements. Because
they are not written in machine-readable language, Python programs need to be
processed before machines can run them.
Python is an interpreted language. This means that every
time a program is run, its interpreter runs through the code and translates it
into machinereadable byte code.
Python is an object-oriented language that allows users to
manage and control data structures or objects to create and run programs.
Everything in Python is, in fact, first class. All objects, data types, functions,
methods, and classes take equal position in Python.
Programming languages are created to satisfy the needs of
programmers and users for an effective tool to develop applications that impact
lives, lifestyles, economy, and society. They help make lives better by
increasing productivity, enhancing communication, and improving efficiency.
Languages die and become obsolete when they fail to live up to expectations and
are replaced and superseded by languages that are more powerful.
Python is a programming language that has stood the test of
time and has remained relevant across industries and businesses and among
programmers, and individual users. It is a living, thriving, and highly useful
language that is highly recommended as a first programming language for those
who want to dive into and experience programming.
Advantages of Using Python
Here are reasons why you would prefer to learn and use
Python over other high level languages:
Python programs use clear, simple, and concise instructions
that are easy to read even by those who have no substantial programming
background. Programs written in Python are, therefore, easier to maintain,
debug, or enhance.
Higher productivity Codes used in Python are considerably
shorter, simpler, and less verbose than other high-level programming languages
such as Java and C++. In addition, it has well-designed built-in features and
standard library as well as access to third party modules and source libraries.
These features make programming in Python more efficient.
Less learning time Python is relatively easy to learn. Many find Python a good
first language for learning programming because it uses simple syntax and
shorter codes.
Runs across different platforms Python works on Windows,
Linux/UNIX, Mac OS X, other operating systems and small-form devices.
It also runs on microcontrollers used in appliances, toys,
remote controls, embedded devices, and other similar devices.
Interacting with Python
Python is a flexible and dynamic language that you can use
in different ways. You can use it interactively when you simply want to test a
code or a statement on a line-by-line basis or when you’re exploring its
features.
You can use it in script mode when you want to interpret an
entire file of statements or application program. To use Python interactively,
you can use either the Command Line window or the IDLE Development Environment.
Command Line Interaction
The command line is the most straightforward way to work
with Python. You can easily visualize how Python works as it responds to every
completed command entered on the prompt.
It may not be the most preferred interaction with Python,
but it is the simplest way to explore how Python works.
Starting Python
There are different ways to access Python’s command line
depending on the operating system installed on your machine:
· If
you’re using Windows, you can start the Python command line by clicking on its
icon or menu item on the Start menu.
· You
may also go to the folder containing the shortcut or the installed files and click
on the Python command line.
· If
you’re using GNU/Linux, UNIX, and Mac OS systems, you have to run the Terminal
Tool and enter the Python command to start your session.
We use commands to tell the computer what to do. When you
want Python to do something for you, you have to instruct it by entering
commands that it is familiar with. Python will then translate these commands to
instructions that your computer or device can understand and execute.
To see how Python works, you can use the print command to
print the universal program “Hello, World!”
Open Python’s command line.
At the >>>prompt,
type the following:
print(“Hello,
World!”)
Press enter to tell Python that
you’re done with your command. Very quickly, the command line window will
display Hello, World! on the following line:
Python responded correctly because you gave it a command in
a format that it requires. To see how it responds when you ask it to print the
same string using a wrong syntax for the print command, type and enter the
following command on the Python command prompt:
Divided into chapters and Exercises
1. The
Context of Software Development
2. Values
and Variables
3. Expressions
and Arithmetic
4. Conditional
Execution
5. Iteration
6. Using
Functions
You can
download pdf and pdf credit zlib

0 Comments