Python Notes

















A programming language is a language consisting of a set of instructions provided by the user that tells a computer what task to do and how to do it. Python, Java, PHP, C++, etc. are some examples of popular programming languages.

Programming: It is the process of providing detailed instructions to a computer step by step to do specific tasks.

Programmer: A programmer is a person who is involved in writing computer programs.

Syntax: The rule for writing commands is called syntax.

High-level programming language

a. These languages use structures and commands that resemble human language, making them easier for people to understand.

b. Programs written in high-level languages are called program code, and they’re readable to humans but not to computers.

Low-level programming language

a. Low-level languages mainly consist of 0s and 1s, which are directly understood by computers. 

b. Programs are written in the form of machine code, which is difficult for humans to comprehend without spec

Language Translator

A language translator is a system software that converts programs written in a high-level language or assembly language into a machine-readable low-level language so that the computer can understand and execute them.

Compiler

A compiler is a language translator that converts the entire high-level program into machine code before execution.  Example, JAVA, C#, C, C++, FORTRAN, etc.

Interpreter

An interpreter is a language translator that converts and executes the high-level program line by line. It translates one instruction at a time, executes it immediately, and then moves to the next instruction. Example, JavaScript, Ruby, List processing (LISP), MATLAB, Python.

Algorithm

An algorithm is a set of step-by-step instructions designed to solve a specific problem or perform a particular task. It begins with “start” and ends with “stop.”

The instructions are written in simple, general language (like spoken languages).

Flowchart

●          A flowchart is defined as the pictorial and graphical representation of an

             algorithm.

●          It utilizes shapes (oval, rectangle, parallelogram, etc.) to depict various

             elements.

●          The shapes have distinct meanings in a flowchart.

●          The flowcharts correspond to algorithms, visually representing their steps and

             structure.

Coding: Coding is the process of writing instructions in a programming language to create software or applications. These instructions, known as code, tell the computer exactly what tasks to perform.

Testing: Once the code is written, testing is conducted to ensure the program functions as expected. This involves running the program to identify any errors or bugs and verifying that all parts of the program work correctly.

Debugging: If testing reveals any errors or bugs, the process of debugging begins. Debugging involves locating the source of the problem in the code, understanding why it occurred, and then making the necessary corrections to fix it.

The table below shows the difference between compiler and interpreter. 

Compiler

Interpreter

A compiler reads and  translates  program  code to   machine  code  all  at  once.   

An interpreter reads and translates program    code  to machine code line by line.    

If  there’s  an error in the program code, it displays    errors at the end.           

If  there is an error in  the program  code,    it displays  while running the program.         

Compiled program’s execution time is comparatively  faster.  

Interpreted  program’s execution time  is    comparatively  slower.           

Compiled programs have separate files to store  machine code.           

An interpreted  program  does  not   have     a  separate  file  to  store machine  code.   


Python, created by Guido van Rossum in 1991, is a highly popular programming language known for its simplicity, versatility, and easy-to-understand syntax. Its syntax is similar to everyday language, making Python especially beginner-friendly and suitable for solving many types of problems, including creating games.

Python also provides many built-in tools and libraries, allowing programmers to perform tasks easily without starting from scratch, which saves time and effort. It is widely used in web development, data science, machine learning, artificial intelligence, automation, game development, web scraping, cybersecurity, and more.

Python uses indentation instead of braces to define code blocks, which improves readability and helps programmers write clean and understandable code. Indentation clearly shows the scope of loops, conditional statements, and other structures.

Features of Python

a. Easy to read and write Python uses simple and understandable syntax, making it easy for programmers to write and understand the code.

b. Versatile Python can be used for a wide range of tasks like simple automating systems to complex web development, data analysis, and Artificial Intelligence.

c. Beginner-friendly Python uses simple syntax, making it a great choice for those who are new to programming.

d. Extensive standard library Python has an extensive standard library of pre-written code that offers programmers ready-made solutions, without requiring them to write code from ground level.

e. Rich ecosystem Python has a vast collection of libraries and ready-made structures known as frameworks that provide ready-to-use tools for programmers.







No comments:

Post a Comment