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

introduction in python

introduction in python BASICS

Uploaded by

Love Sr
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 views8 pages

introduction in python

introduction in python BASICS

Uploaded by

Love Sr
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/ 8

Unit I: Computational Thinking and Programming -1

Chapter- 7 Overview of Python


"Some People Around You Are Just Like the
Semicolon in Python, You Have to Debug the Code
and Omit them From Your Life"
You will learn the following topics in this tutorial
S.No. Topics

1 The official introduction to Python

2 Features of Python

3 Limitation (Minus) of python

4 Downloading and Installing Python

5 Working in Python

6 Interactive mode

7 Working in Script Mode

Page 1 of 8
Unit I: Computational Thinking and Programming -1

Chapter- 7 Overview of Python


The official introduction to Python is:
Python was created by Guido van Rossum in 1991 at the National

Research Institute for Mathematics and Computer Science,

Netherland.

Python is based on the ABC language, a teaching language created to

replace the programming language BASIC.

Python is a simple but powerful scripting language.

Python is a general-purpose, dynamic, interpreted, interactive, high-

level, multiplatform, object-oriented programming language.

It incorporates modules, exceptions, dynamic typing, very high level

dynamic data types, and classes.

One of its most visible features is that it does not use semicolons and

brackets, Python uses indentation instead.

Story behind the name


Guido van Rossum, the creator of the Python language, named the

language after the BBC show "Monty Python's Flying Circus". He doesn't

particularly like snakes that kill animals for food by winding their long

bodies around them and crushing them.

Page 2 of 8
Unit I: Computational Thinking and Programming -1

Chapter- 7 Overview of Python


Features of Python
Python is a high level language. It is a free and open source language.

It is an interpreted language, as Python programs are executed by an

interpreter.

Python programs are easy to understand as they have a clearly defined

syntax and relatively simple structure.

Python is case-sensitive. For example, NUMBER and number are not

same in Python.

Python is portable and platform independent, means it can run on

various operating systems and hardware platforms.

Python is also helpful in web development. Many popular web services

and applications are built using Python.

Python uses indentation for blocks and nested blocks

Python provides interfaces to all major commercial databases..

Limitation (Minus) of python:



Not the fastest language.

Lesser Libraries than C, Java or Perl.

Not Strong on Type-binding

Not Easily convertible

Page 3 of 8
Unit I: Computational Thinking and Programming -1

Chapter- 7 Overview of Python


Downloading and Installing Python
Python can be downloaded and installed for free from

http://www.python.org/download/ and download the latest version.


The installation is just like any other Windows-based software.

Caution When you are given the option of unchecking any "optional"
components, don't uncheck any.

ANACONDA Python distribution is one such highly recommended


distribution that comes with preloaded many packages and libraries
(NumPy, SciPy, Panda etc)
Other Popular IDEs like Sypder, PytCharm, etc. Spyder IDE is available
as a part of ANACONDA.

Working in Python: r----------------------------------------- •


Interactive mode: Interactive Mode,
In Python we can work as the name suggests, allows us to
In 2 ways: interact with OS. For working in the
interactive mode, we will start Python
on our computer.
J
Python Shell
Script mode: In script mode, we type
Python program in a file and then use
the interpreter to execute the content
from the file. Working in interactive
mode is convenient for beginners.

Page 4 of 8
Unit I: Computational Thinking and Programming -1

Chapter- 7 Overview of Python


Interactive mode:
L1^ Python 3.6.5 Shell i i i'
File Edit Shell Debug Options Window Help

Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.l


900 32 bit (Intel)] on Win32
Type "copyright", "credits" or "licensee” for more information.
»> I

Ln: 3 Col: 4

Interactive mode is a command line environment called as Shell of

Python which gives immediate result for each statement fed from

the prompt. The »> (prompt) is Python's way of telling you that you

are in interactive mode and here we can enter our one line statement.
Python 3,6.5 Shell

File Edit Shell Debug Options Window Help

"python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.l


900 32 bit (Intel)] on Win32
Type "copyright", "credits" or "licensee" for more information.
»> a=10
»> b=20 E

»> print ("The sum is :”,a+b)


The sum is : 30
»> print ("The sub is :",a-b)
The sub is : -10
»>
Ln: 11 Col: 4

Working in Script Mode:


Multiple commands can be saved in a file as a program and then we

can execute the entire program

We type Python program in a file and then use the interpreter to

execute the content from the file.


ragej ui o
Unit I: Computational Thinking and Programming -1

Chapter- 7 Overview of Python


Working in interactive mode is convenient for beginners and for

testing small pieces of code, as we can test them immediately.

But for coding more than few lines, we should always save our code

so that we may modify and reuse the code

After starting IDLE from start menu, IDLE open its window

Python 3.6.5 Shell

File Edit Shell Debug Options Window Help

Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.l


900 32 bit (Intel)] on Win32
Type "copyright", "credits" or "licenseO” for more information.
»> I

Ln: 3 Col: 4

1. File>Open OR File>New Window (for creating a new script file)

Python 3.6.5 Shell oIa

| File | Edit Shell Debug Options Window Help


New File 5: f59c0932t>4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Inte
Open... Ctrl+O
Open Module... Alt+M
'credits" or "license()" for more information.
Recent Files ►
Module Browser Alt+C
Path Browser

Save Ctrl+S
Save As... Ctrl+Shift+S
Save Copy As... Alt+Shift+S

Print Window Ctrl+P

Close Alt+F4
Exit Ctrl+Q

Ln: 3 Col: 4

Page 6 of 8
Unit I: Computational Thinking and Programming -1

Chapter- 7 Overview of Python

Sjj Untitled I ° I a faaj


File Edit Format Run Options Window Help

Ln:l Col:0

2. Write the Python code as function i.e. script

jgj Intro.py ~ D:/Xl_Progs/lntro.py (3.6.5) r

File Edit Format Run Options Window Help

a=10
I b=20
print("The sum is :",a+b) =

print("The sub is :",a-b)

Ln: 8 Col: 0

3. Save it (AS)

Executing Python Program

Click Run * Run Module command

Intro.py - D:\XI_Progs\lntro.py (3.6.5) .=. IhJ

File Edit Format Run | Options Window Help


a=10 Python Shell
b=20 Check Module Alt+X

print ("The

print("The sub is :",a-b)

Ln: 7 Col: 0
L

Page 7 of 8
Unit I: Computational Thinking and Programming -1

Chapter- 7 Overview of Python

4. If the code is written correctly, you will see the output in the Python
Shell window

Python 3.6.5 Shell I ■=■ I


File Edit Shell Debug Options Window Help

00 32 bit (Intel)] on Win32


Type "copyright", "credits" or "license()" for more information.
»>
RESTART: D:/XI_Progs/Intro.py

The sum is : 30
The suh is : -10
»>
Ln: 8 Col: 4

Page 8 of 8

You might also like