LEARNING OBJECTIVES
After completingthis chapter, the reader will be familiar with the
following concepts.
• Become familiar with the terminologies used in programming
languages and coding.
• Acquire a fundamental understanding of programming and software.
Chapter 1. INTRODUCTION
3.
• Know howinterpreters and compilers facilitate collaboration between
a computer’s hardware and software in the system’s architecture.
• Overview of the Python Integrated and Learning Environment.
• Ability to use Python as a scripting language.
• Provide awareness about Python programming resources.
• Overview of Python documentation and Support.
Chapter 1. INTRODUCTION
LEARNING OBJECTIVES
4.
1.1 Basics ofProgramming Language
• Problem-solving skill involves identifying issues, formulating
problems, devising solutions, and communicating them
• Computer program is a comprehensive, step-by-step set of
instructions that tells a computer exactly what it should be doing.
Chapter 1. INTRODUCTION
• Coding Mechanism-Codingguarantees that a computer’s software
and hardware can connect by compiling the code into assembly
language.
• High-level and assembly-level languages are then converted into
binary coded signals (1’s and 0’s) to allow computational hardware
and software to communicate.
Chapter 1. INTRODUCTION
7.
• Learning tocode is crucial because it enhances problem-solving and
logic abilities, leverages technology to power business operations, and
facilitates fine-tuning.
• Learning to code leads to better job prospects.
• Programmers make apps, websites, and other digital products that
change how people live worldwide.
Chapter 1. INTRODUCTION
8.
1.2 Programming VersusSoftware
• “Programming” involves giving the computer the instructions and data it
needs on time.
• Programming Mechanism-The process of programming is intricate.
Programming is done in phases, such as composing problem statements,
drawing flowcharts, designing coding algorithms, writing a computer
program, analyzing and evaluating software, technical writing, keeping
software up to date, and so on.
Chapter 1. INTRODUCTION
9.
• Computer softwareis a set of program instructions.
• An algorithm is a set of instructions explaining how a particular
computation should be performed in detail.
• A programming language is a language for writing down the
instructions that a computer will follow. It has a structure of syntax
(precise form) and semantics (actual meaning).
Chapter 1. INTRODUCTION
10.
• There aretwo types of languages, namely low-level languages and high-
level languages.
• Computer hardware's can only run programs written in low-level
languages/machine languages/ assembly languages.
• A computer program is a series of instructions written in a high-level
language to solve a problem.
Chapter 1. INTRODUCTION
11.
1.3 Python ProgrammingLanguage
Characteristics of Python Programming Language
• an open-source, high-level, interpreted, general-purpose, dynamic
programming language
• relatively easy to pick up and use.
• Extensive libraries are available
Chapter 1. INTRODUCTION
12.
• flexibility asa programming language means it can also be used as an
add-on to make highly customizable programs.
• Cross-platform language
• Software quality.
• Python data types are strongly and dynamically typed.
Chapter 1. INTRODUCTION
13.
• embedded easilyinto any application to provide a programmable
interface.
• Developer productivity.
• Python’s rapid edit-test-debug cycle and lack of a compilation step
make development and debugging much more efficient.
Chapter 1. INTRODUCTION
14.
Table 1.1: ObjectOriented Programming Vs.
Procedural Programming Vs. Functional Programming
16.
Limitations of Python
•Speed is an issue. As Python is an interpreted language, it is slower
than compiled languages.
• Design restrictions. The dynamically typed language comes with
errors only at runtime; Python’s global interpreter lock and whitespace
are a few design issues.
Chapter 1. INTRODUCTION
17.
1.3.2 Implementations UsingPython
• utilized for database access, Internet scripting, distributed
programming, and extension-language works.
• used as Graphical User Interfaces (GUI), shell tools -system admin
tools, and command line programs.
• language-based modules -instead of special-purpose parsers.
Chapter 1. INTRODUCTION
18.
1.3.2 Implementations UsingPython
• helpful for rapid prototyping and development.
• used in Web Application development,
• building desktop GUIs,
• Email Parsing,
• Network programs,
• Desktop applications,
• Internet Protocol,
• System administration, and
• Video Games Development.
Chapter 1. INTRODUCTION
19.
1.4 Compiler VersusInterpreter
Fig. 1.2: The Process of Creating a Computer Program
20.
• Compiler (Fig1.3) meticulously scans and converts the source code before
launching the program. In this perspective, the high-level program is called
the source code, and the translated program is called the object code or the
executable. Compiling a program allows users to run it repeatedly without
retranslating it each time. A hardware executor can then run the compiled
object code.
Chapter 1. INTRODUCTION
• Table 1.2:Comparison of Compiler and Interpreter
Table 1.2: Comparison of Compiler and Interpreter
26.
1.5 Integrated DevelopmentEnvironment (IDE)
• IDLE stands for Interactive DeveLopment Environment.IDLE, as an
interpreter, translates the code into a language the computer can
understand.
• Python’s default implementation, IDLE (“Integrated Development and
Learning Environment”), includes the complete set of IDE packages
and fundamentals.
Chapter 1. INTRODUCTION
27.
1.5.1 Python ininteractive mode
(windows OS)
• Shell or Interactive shell or Interactive Interpreter- The Python IDLE
instantly launches a Python shell, saving time.
• It is a Read-Eval-Print Loop (REPL). It reads every statement,
evaluates, and displays a Python statement.
• Code snippets can be run in Python’s Interpreter shell
Chapter 1. INTRODUCTION
28.
1.5.2 Python inscript mode
• A Python script or program is read line by line and executed when run
in script mode.
• In script mode, code can be written in a standalone file (ending in.py)
and run independently.
• These lines of code are easily modifiable and reusable.
Chapter 1. INTRODUCTION
• Common Pythonsyntax colours: Colour coding in IDLE aids in
understanding the meaning so that one can easily visualize the
mistakes made.
• Keywords in orange colour
• Strings in green colour
• Comments in red colour
• Definitions in blue colour
• Misc. Words in black colour
Chapter 1. INTRODUCTION
36.
1.5.3 Command LineInterpreter
• Command Line Interpreter (CLI), Console User Interface (CUI),
command processor, shell, command line shell, and command
interpreter.
• A command line interpreter, also known as a console or shell, takes
user input (typically in the form of a single command) and applies it to
the system.
Chapter 1. INTRODUCTION
37.
• In theabsence of errors, it executes the command and returns the
expected data; otherwise, an error message is displayed.
Fig. 1.17: Python command prompt
38.
1.6 Various Resourcesfor Python
Programming
• Sublime Text 3
• Notepad++
• Atom
• Visual Studio Code
• Vim
Chapter 1. INTRODUCTION