The Way Of The Program
1.2 The Python Programming Language.1.3 What is a program?1.4 What is Debugging?1.5 Formal and Natural Languages.
1.6 The first program.
Pythonis widely usedgeneral purpose, Highlevel programming language. It was initially
designed by Guido Van Rossum
in 1991 anddeveloped by pythonsoftware foundation. It was mainly developed foremphasis on codereadability and itssyntax allows programmable to express
concepts in fewer lines of code.
The Way Of The Program:
The single mostimportant skill for a programmer is problem solving. Problemsolving means the ability to formulate problems,think creatively aboutsolutions, and expressa solution clearly and accurately. As it turns out, the process of learning to program is an excellent opportunity to practice problem-solving skills.
The python programming language:
The programming languages are two types,high-level and Low-level languages. High level languages are designed to be used by the human operator or the programmer. They arereferred to as “closeto humans “. In otherwords, their programming style and contextis easier to learn and implement than low levellanguages, and entirecode generally focuseson the specific program to be created. High level languages are python, c, c++, perland java. Low level languages are machine language and assembly language.
Twokinds of programprocess high levellanguages into lowlevel languages: Interpreters and compilers. An interpreters readsa high level language and executes a code line by line where as complier executes the code after compiling the whole code. Python comes under the interpreter because of it executes every line and it showserror in any particular line.
What is a Program:
A program is a sequenceof instructions that specifies how to performa computation. The computation might be something Mathematical, such as solving a system of equations or finding the roots of a polynomial, but it can also be a symboliccomputation, such as searching and replacing text in a document or complaining a program.
If you want some specificwork from a specific device,then you gavesome lines of code according to yourneeds. That is called PROGRAM.
What is debugging:
Programming is a complex process,and because it is doneby human beings,it often leads to errors. For whimsical reasons, programming errors are called Bugs. The process of tracking them down and correcting them is called DEBUGGING.
Three kinds of errors can occur in a program: SYNTAX errors, RUNTIME errors and
SEMANTIC errors. It is usefulto distinguish betweenthem in orderto track themdown more quickly.
Syntax errorsare the most basic typeof error. Theyarise when the python parseris unable to understand a line of code. Then it showsthe syntax erroron a particular line and the exact word also with this symbol “^”. Thiserrors happens when python can’tunderstand what your are saying.
It doesn’tshow any erroruntil you run the program, it don’t have any syntaxerror. But while executing the program it shows the error, thiserror is calledthe Runtime erroror Exceptions.
The thirdtype of erroris semantic error.The program won’tshows any errorwhile running and executing. Its shows the wrong outputbecause of the small errorsin the program like dividing by 0, end of the line: will be missedlike that. to identify this errors you what to do reverse programming.
Formal and Natural languages:
Natural Languages are the languages thatpeople speak, such as English,Spanish, and French.
Formal Languages are languages thatare designed by people for specific applications. For example, the notation that mathematicians use is a formal languagethat is particular good at denoting
relationships among numbersand symbols. Chemistsuse a formal languageto represent the chemical structure of molecules.
Programming languages are Formal languages that have been designed to express computations.
The first program:
Traditionally, the first programwritten in a new languageis called “Hello, World!” becauseall it does is displaythe words, “Hello,World!” in python,it looks like this:
>>>Print (“Hello, World!”)
This is an example of a Print statement which doesn’t actually print anything on a paper.It is display a value on the screen.In this case, the resultis the words
The quotation marks in the program the beginning and end of the value;they don’t appear in the result.
Problem solving: The process of formulating a problem, findinga solution, and expressing the solution.
High-level language: The python language is designed to be easyfor humans to read and write.
Low-level language: A programming language that is designed to be easy for a computer to execute; also called “Machine language” or “Assembly language”.
Interpreter: To execute a program in a high-level language by translating it one line a time.
Compiler: To translate a program writtenin high-level language into a low-level language all at once, in preparation for later execution.
Source code: A program in a high-level language before beingcompiled. Object code: The output of the compiler after it translates the program. Executable: Another namefor object codethat is readyto be executed. Script: A program storedin a file (usually one that willbe interpreted). Program: A set of instructions thatspecifies a computation.
Algorithm: A general purpose for solving a category of problem.
Bug: An error in a program.
Debugging: The process of finding and removing any of the three kinds of programming errors.
Syntax: The structure of program.
Syntax error: An error in a programthat makes it impossible to parse (and therefore impossible to interpret).
Runtime error: An error thatdoes not occuruntil the programhas started to execute but that prevents from continuing.
Exception: Another name for run time error.
Semantic error: An error in a programthat makes it do something other than whatthe program intended.
Semantics: The meaning of program.
Natural language: Any one of the languages that people speak that evolved naturally.
Formal language: Any one of the languages that people havedesigned for specificpurpose, such as representing mathematical ideas or computer programs; all programming languages are formal languages.
Token:One of the basic elementsof the syntactic structure of a program, analogous to a wordin a natural language.
Parse: To examine a program and analyze the syntactic structure.
Print statement: An instruction thatcauses the pythoninterpreter to displaya value on the screen.