Python Programming Basics - Part 1
Python Programming Basics - Part 1
PYTHON BASICS
Page 1 of 13
PYTHON BASICS
Overview of Python:
Python is a general purpose , interpreted , high-level programming language with
dynamic semantics. It was created by Guido Van Rossum in 1991 and further developed by
python software foundation. It allows to express concepts in fewer lines of code.
Who uses python:
Python is applied in many real revenue generating products by many real companies,
✓ Google:
For system building, log analysis, report generation,etc.
✓ Dropbox:
Allows for efficient file management.
✓ Youtube:
Which serves frontend & API
✓ NASA:
Uses python for data analysis and scientific calculations
✓ Raspberry Pi:
Used to build projects.Eg: blink lights, read sensors,etc.
History of Python:
Python is an interpreted , object oriented , high-level programming level
programming language with dynamic semantics. It was created by Guido Van Rossum in
1991 and further developed by python software foundation. It allows to express concepts in
fewer lines of code.
Founder of Python:
Guido Van Rossum , The founder of Python , was born and raised in Netherlands
with background of mathematics and computer science. He ultimately created one of the
most widely used programming language in the world called Python. So he is known as
father of Python . He developed the language with aim of making programming more
accessible and enjoyable for a wider audience.
Birth of Python:
In the late 1980s , the working on python was started. Guido Van Rossum began
doing its application-based work in December 1989 at Centrum Wiskunde and Informatica
(CWI) , situated in Netherlands.
He had already helped to create ABC earlier and had some issues with ABC but
liked most of the features. He had taken the syntax of ABC, and some of its good features. It
came with a lot of complaints too, so he fixed those issues completely and created a good
scripting language. The inspiration for the name of BBC’s TV Show – ‘Monty Python’s Flying
Circus’ and also he wanted a short, unique and mysterious name and hence he named it as
Python!
Python’s First release:
After few years of development, the language was finally released in 1991. When it
was released, it used a lot fewer codes to express the concepts, when compared to Java,
C++ & C. Its design philosophy was quite good too. Its main objective is to provide code
readability and advanced developer productivity. It had more capability to provide classes
with inheritance, several core data types, exception handling and functions.
Python is a programming as well as a scripting language. This language has various
purposes such as developing, scripting, generation, and software testing. Due to its elegance
and simplicity, top technology organizations like Dropbox, Google, Quora, Mozilla, IBM, Cisco
,etc.,have implemented Python.
Origin features:
• Easy to code and maintain :
It is simple which is easy to learn and code , so it is developer-friendly . It has simple
structure, and a clearly defined syntax.
• Object-oriented:
It supports object-oriented programming language features .
Eg: the concept of object and classes, encapsulation, inheritance, etc.
• Embedded:
allows for execution of Python code inside the InterSystems IRIS process context.
• Extensible in nature:
Means that we can use python code in other languages.
• Integrated Language:
We can easily integrate it with other languages such as C, C++, etc.
• Interpreted Language:
It uses an interpreter for converting the source code into machine code. This execute the
python code line by line.
• Dynamically Typed:
Means that we do not have to define the type of the variable.
• Scalable:
It provides good support for large programs.
➢ Step 3: Once you have downloaded the installer, open the .exe file, such as
python-3.10.11-amd64.exe, by double-clicking it to launch the Python installer.
➢ Step 4: Choose the option to Install the launcher for all users by checking the
corresponding checkbox, so that all users of the computer can access the
Python launcher application
Running Python:
Different ways to run Python Script or code through :
This is the most frequently used way to run a Python code. Here basically
we do the following:
C:\Users\sans>python
Python 3.12.1 (tags/v3.9.2:1a79785, dec 19 2023, 13:44:55) [MSC v.1928
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Example :
Hello World!
Pros:
Cons:
The code is gone as soon as we close the terminal(or the interactive session)
Not user friendly way to write long code.
print("Hello World!!")
python YourFileName.py
Example 1:
print("Hello World!!")
OUTPUT:
C:\Users\deepa>python hello.py
Hello World!!
o Once saved, you can run your code from Run -> Run Module Or simply by pressing F5 --
Output:
o Then you will see a prompt, select the option Python File from the menu, and then type the
new filename.
o Write your code in the Python file you have just created.
o To run this file, Right click on the file name -> Run filename