0% found this document useful (0 votes)
74 views8 pages

Unit 1 Python

Uploaded by

Khushi Pachauri
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
74 views8 pages

Unit 1 Python

Uploaded by

Khushi Pachauri
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 8

lOMoARcPSD|21234109

Unit 1 Python

technology (Dr. A.P.J. Abdul Kalam Technical University)

Studocu is not sponsored or endorsed by any college or university


Downloaded by Khushi (khushipachauri965@gmail.com)
lOMoARcPSD|21234109

Unit 1

Python is a general-purpose interpreted, interactive, object-oriented, and high-level


programming language. It was created by Guido van Rossum during 1985- 1990. Like Perl,
Python source code is also available under the GNU General Public License (GPL). Python
is designed to be highly readable. It uses English keywords frequently where as other
languages use punctuation, and it has fewer syntactical constructions than other languages.

Some of the key advantages of learning Python:


 Python is Interpreted − Python is processed at runtime by the interpreter.
You do not need to compile your program before executing it. This is similar
to PERL and PHP.
 Python is Interactive − You can actually sit at a Python prompt and interact
with the interpreter directly to write your programs.
 Python is Object-Oriented − Python supports Object-Oriented style or
technique of programming that encapsulates code within objects.
 Python is a Beginner's Language − Python is a great language for the
beginner-level programmers and supports the development of a wide range
of applications from simple text processing to WWW browsers to games.
Below are some facts about Python Programming Language:
1. Python is currently the most widely used multi-purpose, high-level
programming language.
2. Python allows programming in Object-Oriented and Procedural
paradigms.
3. Python programs generally are smaller than other programming
languages like Java. Programmers have to type relatively less and
indentation requirement of the language, makes them readable all
the time.
4. Python language is being used by almost all tech-giant companies
like – Google, Amazon, Facebook, Instagram, Dropbox, Uber… etc.
5. The biggest strength of Python is huge collection of standard library
which can be used for the following:
 Machine Learning
 GUI Applications (like Kivy, Tkinter, PyQt etc. )
 Web frameworks like Django (used by YouTube, Instagram,
Dropbox)
 Image processing (like OpenCV, Pillow)
 Web scraping (like Scrapy, BeautifulSoup, Selenium)
 Test frameworks
 Multimedia
 Scientific computing
 Text processing and many more..

Downloaded by Khushi (khushipachauri965@gmail.com)


lOMoARcPSD|21234109

Programming cycle for Python

Python programming cycle is a little bit different from the traditional programming
cycle because, unlike the traditional programming cycle, python DO NOT have
compile or link steps because of this behaviour Python programs run immediately
after changes are made. . The programming Cycle for Python is in rapid prototyping.

The development cycle of Python is considerably shorter than that of traditional


tools. There is no compilation or linking steps in Python. Python programs simply
import modules at runtime and use the objects they contain. Because of this, Python
programs run immediately after changes are made. Also because Python is
interpreted, there’s a rapid turnaround after program changes. And because Python’s
parser is embedded in Python-based systems, it’s easy to modify programs at
runtime.

Traditional programming cycle vs Programming cycle for python


Python programming cycle Traditional programming cycle

STEP #1 RUN THE APPLICATION RUN THE APPLICATION

STEP #2 TEST THE APPLICATION TEST THE APPLICATION

STEP #3 EDIT SORUS CODE AGAIN EDIT SORUS CODE AGAIN

STEP #4 SKIP THIS STEP RECOMPILE

STEP #5 SKIP THIS STEP RE-LINK

STEP #6 REPEAT (IF NEEDED) REPEAT (IF NEEDED)

In simple terms, the python development cycle do not have compiling and linking
steps, unlike the traditional programming cycle.

Downloaded by Khushi (khushipachauri965@gmail.com)


lOMoARcPSD|21234109

Answer to the question , What is programming cycle for Python can be framed as given
below:

Question 1: What is Programming Cycle for Python ?


Answer:
1. Python’s programming cycle is dramatically shorter than that of traditional
programming cycle.
2. In Python, there are no compile or link steps.
3. Python programs simply import modules at runtime and use the objects
they contain. Because of this, Python programs run immediately after changes
are made.
4. In cases where dynamic module reloading can be used, it is even possible
to change and reload parts of a running program without stopping it at all.
5. Python’s impact on the programming cycle is as follows:

Since Python is interpreted, there is a rapid turnaround after program


changes. And because Python’s parser is embedded in Python-based
systems, it is easy to modify programs at runtime.

Downloaded by Khushi (khushipachauri965@gmail.com)


lOMoARcPSD|21234109

Python IDE :
Que 1.2. What is IDE ? Discuss some Python IDE.
Answer
1. IDE is a software package that consists of several tools for developing and
testing the software.
2. An IDE helps the developer by automating the process.
3. IDEs integrate many tools that are designed for SDLC.
4. IDEs were introduced to diminish the coding and typing errors.
5. Some of the Python IDEs are :
a. PyCharm : PyCharm assists the developers to be more productive and
provides smart suggestions. It saves time by taking care of routine tasks,
hence increases productivity.
Features of PyCharm :
i. It has smart code navigation, good code editor, a function for quick
refactoring.
ii. The integrated activities with PyCharm are profiling, testing, debugging,
remote development, and deployments.
iii. PyCharm supports Python web development frameworks, Angular JS,
JavaScript, CSS, HTML and live editing functions.
b. Spyder : Spyder is widely used for data science works. It is mostly used to
create a secure and scientific environment for Python. Spyder Python uses
PyQt (Python plug-in) which a developer can add as an extension.
Features of Spyder :
i. It has good syntax highlighting and auto code completion
features.
ii. Spyder Python explores and edits variables directly from GUI.
iii. It performs very well in multi-language editor.

Downloaded by Khushi (khushipachauri965@gmail.com)


lOMoARcPSD|21234109

c. PyDev : It is an external plug-in for Eclipse and is very popular as Python


interpreter.
Features of PyDev :
i. PyDev has strong parameters like refactoring, debugging, type hinting, code
analysis, and code coverage function.
ii. PyDev supports tokens browser, PyLint integration, interactive console,
remote debugger, Unittest integration, etc.
d. IDLE : IDLE is a basic IDE mainly used by beginner level developer.
i. IDLE Python is a cross-platform IDE, hence it increases the flexibility for
users.
ii. It is developed only in Python in collaboration with Tkinter GUI toolkit.
iii. The feature of multi-window text editor in IDLE has some great functions
like smart indentation, call tips, Python colorizing, and undo option.
e. Visual studio : It enables development for various platforms and has its
own marketplace for extensions.
Features of visual studio :
i. It supports Python coding in visual studio, debugging, and other activities.
ii. It has both paid and free versions in the market with great features.

Interacting with Python Programs


In Python, there are two options/methods for running code:

 Interactive mode
 Script mode

Interactive Mode

Interactive mode, also known as the REPL provides us with a quick way of
running blocks or a single line of Python code. The code executes via the
Python shell, which comes with Python installation. Interactive mode is

Downloaded by Khushi (khushipachauri965@gmail.com)


lOMoARcPSD|21234109

handy when you just want to execute basic Python commands or you are
new to Python programming

To access the Python shell, open the terminal of your operating system and
then type "python". Press the enter key and the Python shell will appear.
This is the same Python executable you use to execute scripts, which
comes installed by default on Mac and Unix-based operating systems.

C:\Windows\sys

tem32>python

Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit

(AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.

>>>

The >>> indicates that the Python shell is ready to execute and send your
commands to the Python interpreter. The result is immediately displayed on
the Python shell as soon as the Python interpreter interprets the command.

To run your Python statements, just type them and hit the enter key. You
will get the results immediately, unlike in script mode. For example, to print
the text "Hello World", we can type the following:

>>> print("Hello World")


Hello World
>>>
Here are other examples:
>>> 10
10
>>> print(5 * 20)
100
>>> "hi" * 5
'hihihihihi'
>>>

Downloaded by Khushi (khushipachauri965@gmail.com)


lOMoARcPSD|21234109

Pros and Cons of Interactive Mode

The following are the advantages of running your code in interactive mode:

1. Helpful when your script is extremely short and you want immediate
results.
2. Faster as you only have to type a command and then press the enter
key to get the results.
3. Good for beginners who need to understand Python basics.

The following are the disadvantages of running your code in the interactive
mode:

1. Editing the code in interactive mode is hard as you have to move


back to the previous commands or else you have to rewrite the whole
command again.
2. It's very tedious to run long pieces of code.

Downloaded by Khushi (khushipachauri965@gmail.com)

You might also like