Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views5 pages

Ch1. Introduction To Python

Uploaded by

shivbhakt7310
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Ch1. Introduction To Python

Uploaded by

shivbhakt7310
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Introduction to Programming

A programming is a process to make programs that are set of instructions and syntax
used to create software using suitable programming language. Some of the key
features of programming languages include:
1. Syntax: The specific rules and structure used to write code in a programming
language.
2. Data Types: The type of values that can be stored in a program, such as numbers,
strings, and booleans.
3. Variables: Named memory locations that can store values.
4. Operators: Symbols used to perform operations on values, such as addition,
subtraction, and comparison.
5. Control Structures: Statements used to control the flow of a program, such as if-
else statements, loops, and function calls.
6. Libraries and Frameworks: Collections of pre-written code that can be used to
perform common tasks and speed up development.
7. Paradigms: The programming style or philosophy used in the language, such as
procedural, object-oriented, or functional.
Examples of popular programming languages include Python, Java, C++, JavaScript,
and Ruby. Each language has its own strengths and weaknesses and is suited for
different types of projects.
A programming language is a formal language that specifies a set of instructions for a
computer to perform specific tasks. It’s used to write software programs and
applications, and to control and manipulate computer systems. There are many
different programming languages, each with its own syntax, structure, and set of
commands. Some of the most commonly used programming languages include Java,
Python, C++, JavaScript, and C#. The choice of programming language depends on
the specific requirements of a project, including the platform being used, the intended
audience, and the desired outcome. Programming languages continue to evolve and
change over time, with new languages being developed and older ones being updated
to meet changing needs.

Types of Programming
There are basically two types of programming techniques.
1) Procedural or Structured Programming
2) Object Oriented Programming

1. Structured Programming :
Structured Programming, as name suggests, is a technique that is
considered as precursor to OOP and usually consists of well-structured and
separated modules. In this programming, user can create its own user-
defined functions as well as this methodology tries to resolve issues that are
associated with unconditional transfers to allow programmers follow logic of
programs. It also requires more discipline at the design and logical
structuring stage.
Example : Pascal, ALGOL, C, Modula-2, etc.

2. Object-Oriented Programming :
Object-Oriented Programming, as name suggests, is a different approach to
programming that brings together data and functions that execute on them. It
basically supports encapsulation, abstraction, inheritance, polymorphism,
etc. It also includes data hiding feature therefore it is more secure. This
model is based on real life entities that focuses on by whom task is to be
done rather than focusing on what to do.
Example :Java, C++, C# etc.

Introduction To Python
Python is a widely used general-purpose, high level programming language. It was
created by Guido van Rossum in 1991 and further developed by the Python Software
Foundation. It was designed with an emphasis on code readability, and its syntax
allows programmers to express their concepts in fewer lines of code.
Python is a programming language that lets you work quickly and integrate systems
more efficiently.
There are two major Python versions: Python 2 and Python 3. Both are quite
different.

Steps to install Python on Windows


We have provided step-by-step instructions to guide you and ensure a
successful installation. Whether you are new to programming or have some
experience, mastering how to install Python on Windows will enable you to
utilize this potent language and uncover its full range of potential applications.

Downloading the Python Installer

To download Python on your system, you can use the following steps.
 Visit the official download page of python.org on the Windows operating
system.
 Locate a reliable version of Python2 or Python 3, preferably version
3.10.11, which was compatible with your system
 Choose the correct link for your device from the options provided: either
Windows installer (64-bit) or Windows installer (32-bit) and proceed to
download the executable file.
 Install the executable file (Python Interpreter) with follow wizard steps.
 After Successfully Installation, Please open python IDLE to check that
python work successfully or not.

Working Mode of Python



Python is a programming language that lets you work quickly and integrate systems
more efficiently. It is a widely-used general-purpose, high-level programming
language. It was designed with an emphasis on code readability, and its syntax allows
programmers to express their concepts in fewer lines of code. In the Python
programming language, there are two ways in which we can run our code:
1. Interactive mode
2. Script mode
In this article, we’ll get to know what these modes are and how they differ from each
other.

Interactive mode

Interactive etymologically means “working simultaneously and creating impact of our


work on the other’s work”. Interactive mode is based on this ideology only. In the
interactive mode as we enter a command and press enter, the very next step we get the
output. The output of the code in the interactive mode is influenced by the last command
we give. Interactive mode is very convenient for writing very short lines of code. In
python it is also known as REPL which stands for Read Evaluate Print Loop. Here, the
read function reads the input from the user and stores it in memory. Eval function
evaluates the input to get the desired output. Print function outputs the evaluated result.
The loop function executes the loop during the execution of the entire program and
terminates when our program ends. This mode is very suitable for beginners in
programming as it helps them evaluate their code line by line and understand the
execution of code well.
How to run python code in Interactive mode?
In order to run our program in the interactive mode, we can use command prompt in
windows, terminal in Linux, and macOS. Let us see understand the execution of python
code in the command prompt with the help of an example:
Example 1:
To run python in command prompt type “python”. Then simply type the Python
statement on >>> prompt. As we type and press enter we can see the output in the very
next line.

Disadvantages of interactive mode


 The interactive mode is not suitable for large programs.
 The interactive mode doesn’t save the statements. Once we make a
program it is for that time itself, we cannot use it in the future. In order to
use it in the future, we need to retype all the statements.
 Editing the code written in interactive mode is a tedious task. We need to
revisit all our previous commands and if still, we could not edit we need to
type everything again.

Script Mode

Script etymologically means a system of writing. In the script mode, a python


program can be written in a file. This file can then be saved and executed
using the command prompt. We can view the code at any time by opening the
file and editing becomes quite easy as we can open and view the entire code
as many times as we want. Script mode is very suitable for writing long pieces
of code. It is much preferred over interactive mode by experts in the program.
The file made in the script mode is by default saved in the Python installation
folder and the extension to save a python file is “.py”.
How to run python code in script mode?
In order to run a code in script mode follow the following steps.
Step 1: Open python IDLE interactive mode, click file menu select new file.
Step 2: A blank file open it save it with any name but with extension .py.

OR

Step 1: Make a file using a text editor. You can use any text editor of your
choice(Here I use notepad).
Step 2: After writing the code save the file using “.py” extension.
Step 3: Now open the command prompt and command directory to the one
where your file is stored.
Step 4: Type python “filename.py” and press enter.
Step 5: You will see the output on your command prompt.

You might also like