Sunday, October 20, 2024

Python Basic to Advanced Learnings ( Day 1 )


History of programming language

·        We as human beings have a good ability to solve any of the problems.

·        But the challenge with humans is that they are lazy and they make some mistakes also.

·        To overcome this challenge we have created computers to simply our tasks.

·        The computers consist of the CPU, RAM, Hard disk etc.

·        It makes our tasks easier in a very fast manner and they can work for endless time.

·        The challenge with the computer or the hardware’s or the machine is that they cannot understand the human language, so for this we have to use a common language that both the humans and the

·        computers can understand.

·        That’s why we have created the programming languages so that we

·        They can interact with the computers and can make them do tasks for us.

·        There are 9000 programming languages exist in our base and each is having different abilities.

·        Computer does not know how to solve any of the problems, we have to instruct it using some algorithms and the programming languages.

·        The concepts of all programming languages are same, the only difference is syntax.

·        For computer to understand the language , first we have to teach the computer ( ex. Install the python ­)

 

Python

Python is a high-level programming language known for its readability and versatility

Use Cases of Python

Python programming is used in many different fields

Web development : Python is used to build websites and web applications. Some frameworks and micro-frameworks used in web development with Python include Django, Pyramid, Flask, and Bottle.

Data science : Python is used for data analysis, data visualization, and data engineering. Some libraries used in data science with Python include SciPy and Pandas.

Machine learning : Python is used to develop AI and ML-powered solutions. Python's stability, security, and scope make it ideal for running AI and ML systems.

Software development : Python is used to develop software, and is also used for software testing and prototyping.

Automation/Devops : Python is used for task automation and scripting.

 

 

Advantages of Python

Why I took python as a programming language ?

I am planning for career change in devops so preferring python over other languages

Easy to learn - Python is considered one of the easiest coding languages to learn, especially for beginners. It has a clear and easy-to-read syntax.

Large community - Python has a large and active community of programmers.

Open source - Python is open source, and it has a large and active community that contributes to its development and provides support.

Third-party libraries - Python has a large collection of third-party libraries. Libraries are pre-written computer programs that allow users to access certain functionality.

Extensible - Python is extensible through the use of add-on modules, libraries, frameworks, and tool-kits.

Interpreted Language - Python is an interpreted language, implying that the code is implemented line by line. Python only shows one error, even if the program has multiple errors. This makes debugging easier.

Dynamically typed language - Python is dynamically typed, meaning you don’t need to declare data types explicitly, making it flexible but still reliable.

Portable and interactive - Python is portable across operating systems and interactive, allowing real-time code execution and testing.

Disadvantages of Python

Slow speed - Python is an interpreted language, meaning that each line of code is executed one at a time, which can make it slower than compiled languages like Java or C.

High memory usage - Python's automatic memory management (garbage collection) can lead to high memory usage, especially in memory-intensive applications.

Weak mobile computing - Python is not well suited for mobile development because it uses too much memory and has a slower processing speed than other languages.

Database access - Python's database access layer is underdeveloped compared to popular technologies like JDBC and ODBC.

Security - Python is a dynamically typed language, which can lead to vulnerabilities.

No support for multithreading - Python only allows one process to run at once.

Lack of documentation - Python may lack good documentation.

Poor support for beginners - Python may not provide good support for beginner programmers.

Harder to Avoid Runtime Errors - Since Python is a language with dynamic typing, the data type of a variable can change at any time. Runtime errors can result from a variable containing an integer number holding a string in the future. As a result, applications must be thoroughly tested by Python programmers.

 

Organizations using python

instagram - uses python and django for its photo and video sharing platform. Instagram chose Python for its simplicity, efficiency, and practicality.

Spotify - Uses Python for its music streaming service. Spotify chose Python for its increased development speed and enhanced analytics. The organization uses Python async frameworks for IO-bound services.

Dropbox - Uses Python on both the server and client sides. Dropbox chose Python for its cross-platform capabilities and readability.

Reddit - Uses Python for its development flexibility and wider access to code libraries. The server-side of Reddit is written in Python.

Pinterest - Uses Python and Django to rapidly deal with large amounts of content.

Quora - Uses Python for its internal system that manages the display of content on the webpage. Quora’s backend uses a variety of Python packages, including Tornado and PyPy, among others.

Netflix - Uses Python to boost the performance of its system.

Google - Uses Python for analytical algorithms within search engines and around YouTube for various tasks, such as video processing and data analysis.

Amazon - created Python machine learning algorithms that work with the company’s Hadoop data storage system. Amazon’s well-known recommendation engine, which urges us to buy new things, is powered by this powerful analytics stack.

 

Polyglot in programming

Polyglot programming is the practice of writing code in multiple programming languages to take advantage of each language's strengths for different tasks.

Main Reasons :

Functionality: A single language might not provide the desired level of functionality.

Speed: A single language might not provide the desired level of speed.

Compatibility: A single language might not interact properly with the database or the desired delivery platform.

Efficiency: A programmer can make the most of a set of programming languages by using different ones

Example

Netflix uses Java, python, javascript, scala & go, Ruby on rails and many more languages

Java

The primary language for backend services and microservices architecture. Java is also used for mobile app development.

Python

Used for data science and machine learning. Netflix developers use Python to rewrite some Java processes.

JavaScript

Used for the frontend and some backend tasks. JavaScript is a core programming language for web development.

Scala and Go

Used for data processing and performance-critical systems. Netflix web developers chose Go because it was faster than Java and less time-consuming than C.

Ruby on Rails

Used to help with the overall architecture of Netflix's platform

 

Python Interpreter

·        A Python interpreter is a computer program that translates Python code into machine code so that a computer can understand it.

·        Commonly used interpreters in python,

ü  CPython

ü  IronPython

ü  Jython

ü  PyPy

ü  Transcrypt

ü  PythonNet

ü  Stackless Python

ü  Nutika

ü  Anaconda

·        Here we are going to install anaconda.


Anaconda Installation

·        Go to the below URL and download the anaconda installer.

https://www.anaconda.com/download?utm_source=anacondadocs&utm_medium=documentation&utm_campaign=download&utm_content=installwindows





Download the requirement.txt from the drive and install it








C:\Users\John Jayakumar\Downloads>pip install -r requirement.txt






Python IDE

·        An IDE (Integrated Development Environment) is a software application that helps programmers write, debug, and test code more efficiently.

·        Below are few of python IDE’s which are commonly used,

ü  PyCharm

ü  Visual Studio Code

ü  Spyder

ü  Jupyter Notebooks

ü  Sublime Text

ü  Thonny

ü  Eclipse

·        Here we are going to user jupyter notebook for start learning the python.

·        Anaconda gives us the IDE which is jupyter notebook

Jupyter Notebook

·        Open CMD and type the below command

C:\Users\John Jayakumar>jupyter notebook





·        It will open a new browser window, with the below link.

http://localhost:8888/tree                                                                                                              








·        Instead we can use python interpreter using the below command

C:\Users\John Jayakumar>python




>>> - REPL – Read Evaluate Print Loop

REPL is an acronym for Read, Evaluate, Print, and Loop.

Developers use REPL Python to communicate with the Python Interpreter.

In contrast to running a Python file, you can input commands in the REPL and see the results displayed immediately.

Functions in Python

Functions are the set of instructions to perform any of the tasks.

Print() Function

Example : Print()

·        Here, print() is to print prints the specified message to the screen, or other standard output device.

·        The message can be a string, or any other object, the object will be converted into a string before written to the screen.





Variables in Python

·        Variable is a named container in the computer's memory that stores data values and can be manipulated.

·        Data stored in the variable is stored somewhere on the RAM.

·        It stores the data with the memory address.

 

Here x – Variable

= - is a function used to store the data

10 – is the data





Id() function

id() function is used to return a unique identification value of the object stored in the memory.

To check the memory address where the 10 is stored on the RAM, we can use the id() function.

Id(x)



 

 


No comments:

Post a Comment

Python Basic to Advanced Learnings ( Day 3 )

Algorithm in python Definition An algorithm is a list of steps or statements that can be converted into code and executed by a computer....

Popular Posts